{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/readability/pulls/comments/26894680","id":26894680,"diff_hunk":"@@ -544,17 +563,17 @@ Readability.prototype = {\n        * A score is determined by things like number of commas, class names, etc. Maybe eventually link density.\n       **/\n       var candidates = [];\n-      for (var pt = 0; pt < elementsToScore.length; pt += 1) {\n-        var parentNode = elementsToScore[pt].parentNode;\n+      this._forEachNode(elementsToScore, function(elementToScore) {","path":"Readability.js","position":171,"original_position":171,"commit_id":"4f9615cb9af8f3b27bc1448c445bb1c7c5aabd23","original_commit_id":"4f9615cb9af8f3b27bc1448c445bb1c7c5aabd23","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"> Or update _forEachNode to check Array.isArray before doing the .call thing...\r\n\r\nWould this be to address a possible performance penalty? Because applying the method from the prototype on an array works exactly the same way, and has nearly no impact on performances…","created_at":"2015-03-21T16:58:54Z","updated_at":"2015-03-21T16:58:54Z","html_url":"https://github.com/mozilla/readability/pull/52#discussion_r26894680","pull_request_url":"https://api.github.com/repos/mozilla/readability/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/mozilla/readability/pulls/comments/26894680"},"html":{"href":"https://github.com/mozilla/readability/pull/52#discussion_r26894680"},"pull_request":{"href":"https://api.github.com/repos/mozilla/readability/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/readability/pulls/52","id":31668945,"html_url":"https://github.com/mozilla/readability/pull/52","diff_url":"https://github.com/mozilla/readability/pull/52.diff","patch_url":"https://github.com/mozilla/readability/pull/52.patch","issue_url":"https://api.github.com/repos/mozilla/readability/issues/52","number":52,"state":"open","locked":false,"title":"Use forEach when it makes sense.","user":{"login":"n1k0","id":41547,"avatar_url":"https://avatars.githubusercontent.com/u/41547?v=3","gravatar_id":"","url":"https://api.github.com/users/n1k0","html_url":"https://github.com/n1k0","followers_url":"https://api.github.com/users/n1k0/followers","following_url":"https://api.github.com/users/n1k0/following{/other_user}","gists_url":"https://api.github.com/users/n1k0/gists{/gist_id}","starred_url":"https://api.github.com/users/n1k0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n1k0/subscriptions","organizations_url":"https://api.github.com/users/n1k0/orgs","repos_url":"https://api.github.com/users/n1k0/repos","events_url":"https://api.github.com/users/n1k0/events{/privacy}","received_events_url":"https://api.github.com/users/n1k0/received_events","type":"User","site_admin":false},"body":"This is WiP, do not merge yet.\r\n\r\nI'm finding all these for loops hard to read and error prone since we use `var` instead of `let` statements.\r\n\r\nI'm suggesting we loop using `forEach` whenever it makes sense to address both issues.\r\n\r\n@leibovic @gijsk thoughts?","created_at":"2015-03-21T09:40:00Z","updated_at":"2015-03-21T16:58:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3db3ada1a5e2cf41f4e095098b3f1311a2857807","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/readability/pulls/52/commits","review_comments_url":"https://api.github.com/repos/mozilla/readability/pulls/52/comments","review_comment_url":"https://api.github.com/repos/mozilla/readability/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/readability/issues/52/comments","statuses_url":"https://api.github.com/repos/mozilla/readability/statuses/4f9615cb9af8f3b27bc1448c445bb1c7c5aabd23","head":{"label":"mozilla:forEach-loops","ref":"forEach-loops","sha":"4f9615cb9af8f3b27bc1448c445bb1c7c5aabd23","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":30231828,"name":"readability","full_name":"mozilla/readability","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/readability","description":"A standalone version of the readability lib","fork":false,"url":"https://api.github.com/repos/mozilla/readability","forks_url":"https://api.github.com/repos/mozilla/readability/forks","keys_url":"https://api.github.com/repos/mozilla/readability/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/readability/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/readability/teams","hooks_url":"https://api.github.com/repos/mozilla/readability/hooks","issue_events_url":"https://api.github.com/repos/mozilla/readability/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/readability/events","assignees_url":"https://api.github.com/repos/mozilla/readability/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/readability/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/readability/tags","blobs_url":"https://api.github.com/repos/mozilla/readability/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/readability/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/readability/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/readability/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/readability/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/readability/languages","stargazers_url":"https://api.github.com/repos/mozilla/readability/stargazers","contributors_url":"https://api.github.com/repos/mozilla/readability/contributors","subscribers_url":"https://api.github.com/repos/mozilla/readability/subscribers","subscription_url":"https://api.github.com/repos/mozilla/readability/subscription","commits_url":"https://api.github.com/repos/mozilla/readability/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/readability/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/readability/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/readability/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/readability/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/readability/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/readability/merges","archive_url":"https://api.github.com/repos/mozilla/readability/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/readability/downloads","issues_url":"https://api.github.com/repos/mozilla/readability/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/readability/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/readability/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/readability/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/readability/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/readability/releases{/id}","created_at":"2015-02-03T08:01:54Z","updated_at":"2015-03-21T15:18:54Z","pushed_at":"2015-03-21T14:10:07Z","git_url":"git://github.com/mozilla/readability.git","ssh_url":"git@github.com:mozilla/readability.git","clone_url":"https://github.com/mozilla/readability.git","svn_url":"https://github.com/mozilla/readability","homepage":null,"size":952,"stargazers_count":49,"watchers_count":49,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":13,"forks":7,"open_issues":13,"watchers":49,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"f7c0e4713f492a7afe322691de4fd82c2b11feed","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":30231828,"name":"readability","full_name":"mozilla/readability","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/readability","description":"A standalone version of the readability lib","fork":false,"url":"https://api.github.com/repos/mozilla/readability","forks_url":"https://api.github.com/repos/mozilla/readability/forks","keys_url":"https://api.github.com/repos/mozilla/readability/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/readability/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/readability/teams","hooks_url":"https://api.github.com/repos/mozilla/readability/hooks","issue_events_url":"https://api.github.com/repos/mozilla/readability/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/readability/events","assignees_url":"https://api.github.com/repos/mozilla/readability/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/readability/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/readability/tags","blobs_url":"https://api.github.com/repos/mozilla/readability/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/readability/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/readability/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/readability/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/readability/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/readability/languages","stargazers_url":"https://api.github.com/repos/mozilla/readability/stargazers","contributors_url":"https://api.github.com/repos/mozilla/readability/contributors","subscribers_url":"https://api.github.com/repos/mozilla/readability/subscribers","subscription_url":"https://api.github.com/repos/mozilla/readability/subscription","commits_url":"https://api.github.com/repos/mozilla/readability/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/readability/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/readability/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/readability/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/readability/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/readability/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/readability/merges","archive_url":"https://api.github.com/repos/mozilla/readability/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/readability/downloads","issues_url":"https://api.github.com/repos/mozilla/readability/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/readability/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/readability/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/readability/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/readability/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/readability/releases{/id}","created_at":"2015-02-03T08:01:54Z","updated_at":"2015-03-21T15:18:54Z","pushed_at":"2015-03-21T14:10:07Z","git_url":"git://github.com/mozilla/readability.git","ssh_url":"git@github.com:mozilla/readability.git","clone_url":"https://github.com/mozilla/readability.git","svn_url":"https://github.com/mozilla/readability","homepage":null,"size":952,"stargazers_count":49,"watchers_count":49,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":13,"forks":7,"open_issues":13,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/readability/pulls/52"},"html":{"href":"https://github.com/mozilla/readability/pull/52"},"issue":{"href":"https://api.github.com/repos/mozilla/readability/issues/52"},"comments":{"href":"https://api.github.com/repos/mozilla/readability/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/readability/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/readability/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/readability/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/readability/statuses/4f9615cb9af8f3b27bc1448c445bb1c7c5aabd23"}}}}