{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14810","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14810/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14810/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14810/events","html_url":"https://github.com/angular/angular.js/issues/14810","id":161353113,"number":14810,"title":"useless code in function jqLiteBuildFragment?","user":{"login":"deplay","id":13115939,"avatar_url":"https://avatars.githubusercontent.com/u/13115939?v=3","gravatar_id":"","url":"https://api.github.com/users/deplay","html_url":"https://github.com/deplay","followers_url":"https://api.github.com/users/deplay/followers","following_url":"https://api.github.com/users/deplay/following{/other_user}","gists_url":"https://api.github.com/users/deplay/gists{/gist_id}","starred_url":"https://api.github.com/users/deplay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deplay/subscriptions","organizations_url":"https://api.github.com/users/deplay/orgs","repos_url":"https://api.github.com/users/deplay/repos","events_url":"https://api.github.com/users/deplay/events{/privacy}","received_events_url":"https://api.github.com/users/deplay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20$compile","name":"component: $compile","color":"e102d8"},{"url":"https://api.github.com/repos/angular/angular.js/labels/needs:%20more%20info","name":"needs: more info","color":"d7eb9f"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20refactor","name":"type: refactor","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/35","html_url":"https://github.com/angular/angular.js/milestones/Purgatory","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/35/labels","id":526241,"number":35,"title":"Purgatory","description":"This milestone is for issues and PRs that weren't accepted yet and we are waiting for more info from the submitter.\r\n\r\nFor issues this typically means that we weren't able to reproduce the issue or we haven't decided yet if a feature request is a good idea at all.\r\n\r\nFor PRs this means that the PR still needs a lot of work and we might not even be interested in merging it because it looks like a non-core feature. We are still waiting for more discussion within the team or more info from the contributor before making the final decision.","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":41,"closed_issues":809,"state":"open","created_at":"2014-01-04T01:20:50Z","updated_at":"2016-06-23T18:43:51Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-06-21T05:35:49Z","updated_at":"2016-06-23T19:38:45Z","closed_at":null,"body":"filepath:angular.js/src/jqLite.js\r\n\r\ncode:\r\n```\r\nfunction jqLiteBuildFragment(html, context) {\r\n  var tmp, tag, wrap,\r\n      fragment = context.createDocumentFragment(),\r\n      nodes = [], i;\r\n\r\n  if (jqLiteIsTextNode(html)) {\r\n    // Convert non-html into a text node\r\n    nodes.push(context.createTextNode(html));\r\n  } else {\r\n    // Convert html into DOM nodes\r\n\r\n\r\n// This line is suspicious\r\n  tmp =  tmp || fragment.appendChild(context.createElement(\"div\"))\r\n\r\n\r\n\r\n    tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\r\n    wrap = wrapMap[tag] || wrapMap._default;\r\n    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\r\n\r\n    // Descend through wrappers to the right content\r\n    i = wrap[0];\r\n    while (i--) {\r\n      tmp = tmp.lastChild;\r\n    }\r\n\r\n    nodes = concat(nodes, tmp.childNodes);\r\n\r\n    tmp = fragment.firstChild;\r\n    tmp.textContent = \"\";\r\n  }\r\n\r\n  // Remove wrapper from fragment\r\n  fragment.textContent = \"\";\r\n  fragment.innerHTML = \"\"; // Clear inner HTML\r\n  forEach(nodes, function(node) {\r\n    fragment.appendChild(node);\r\n  });\r\n\r\n  return fragment;\r\n}\r\n```\r\n\r\nwhen the function jqLiteBuildFragment is excuted,\r\nif the js vm run the italic line above,\r\nin my opinion\r\nthe 'tmp' at the right of the equals sign is always 'undefined'\r\nso the 'fragment.appendChild(context.createElement(\"div\"))' is always exec and return to the left 'tmp'\r\nso the part ‘tmp ||’ isunneccessary.\r\n\r\nany one would give me some suggestion on this problem ?"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/228160756","html_url":"https://github.com/angular/angular.js/issues/14810#issuecomment-228160756","issue_url":"https://api.github.com/repos/angular/angular.js/issues/14810","id":228160756,"user":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T19:38:45Z","updated_at":"2016-06-23T19:38:45Z","body":"Yeah, it is unnecessary. @deplay, would you like to submit a PR.\r\n(Don't worry about the tests. If you can't run them locally, they will run on CI, once you submit the PR.)"}}
{"actor":{"display_login":"gkalpak"}}