{"action":"created","comment":{"url":"https://api.github.com/repos/angular/protractor/pulls/comments/35047883","id":35047883,"diff_hunk":"@@ -350,23 +350,7 @@ ElementArrayFinder.prototype.toElementFinder_ = function() {\n  */\n ElementArrayFinder.prototype.count = function() {\n   return this.getWebElements().then(function(arr) {\n-    var list = arr.map(function(webElem) {\n-      // Calling any method forces a staleness check\n-      return webElem.isEnabled().then(function() {\n-        return 1; // is present\n-      }, function(err) {\n-        if (err.code == webdriver.error.ErrorCode.STALE_ELEMENT_REFERENCE) {\n-          return 0; // not present\n-        } else {\n-          throw err;\n-        }\n-      });\n-    });\n-    return webdriver.promise.all(list).then(function(presenceArr) {\n-      return presenceArr.reduce(function(acc, isPresent) {\n-        return acc + isPresent;\n-      }, 0);\n-    });\n+    return arr.length;","path":"lib/element.js","position":21,"original_position":21,"commit_id":"99a2f5917459445e37775d2b849162e298bbbe42","original_commit_id":"99a2f5917459445e37775d2b849162e298bbbe42","user":{"login":"juliemr","id":2081709,"avatar_url":"https://avatars.githubusercontent.com/u/2081709?v=3","gravatar_id":"","url":"https://api.github.com/users/juliemr","html_url":"https://github.com/juliemr","followers_url":"https://api.github.com/users/juliemr/followers","following_url":"https://api.github.com/users/juliemr/following{/other_user}","gists_url":"https://api.github.com/users/juliemr/gists{/gist_id}","starred_url":"https://api.github.com/users/juliemr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliemr/subscriptions","organizations_url":"https://api.github.com/users/juliemr/orgs","repos_url":"https://api.github.com/users/juliemr/repos","events_url":"https://api.github.com/users/juliemr/events{/privacy}","received_events_url":"https://api.github.com/users/juliemr/received_events","type":"User","site_admin":false},"body":"After reviewing the code, I agree with Hank - I don't see a way that `this.getWebElements` doesn't immediately send webdriver find elements calls, so I don't think they can be stale.","created_at":"2015-07-20T21:42:07Z","updated_at":"2015-07-20T21:42:07Z","html_url":"https://github.com/angular/protractor/pull/2364#discussion_r35047883","pull_request_url":"https://api.github.com/repos/angular/protractor/pulls/2364","_links":{"self":{"href":"https://api.github.com/repos/angular/protractor/pulls/comments/35047883"},"html":{"href":"https://github.com/angular/protractor/pull/2364#discussion_r35047883"},"pull_request":{"href":"https://api.github.com/repos/angular/protractor/pulls/2364"}}},"pull_request":{"url":"https://api.github.com/repos/angular/protractor/pulls/2364","id":40394885,"html_url":"https://github.com/angular/protractor/pull/2364","diff_url":"https://github.com/angular/protractor/pull/2364.diff","patch_url":"https://github.com/angular/protractor/pull/2364.patch","issue_url":"https://api.github.com/repos/angular/protractor/issues/2364","number":2364,"state":"open","locked":false,"title":"fix(element): ElementArrayFinder.count was slow","user":{"login":"hankduan","id":1059345,"avatar_url":"https://avatars.githubusercontent.com/u/1059345?v=3","gravatar_id":"","url":"https://api.github.com/users/hankduan","html_url":"https://github.com/hankduan","followers_url":"https://api.github.com/users/hankduan/followers","following_url":"https://api.github.com/users/hankduan/following{/other_user}","gists_url":"https://api.github.com/users/hankduan/gists{/gist_id}","starred_url":"https://api.github.com/users/hankduan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hankduan/subscriptions","organizations_url":"https://api.github.com/users/hankduan/orgs","repos_url":"https://api.github.com/users/hankduan/repos","events_url":"https://api.github.com/users/hankduan/events{/privacy}","received_events_url":"https://api.github.com/users/hankduan/received_events","type":"User","site_admin":false},"body":"The bug fix for #1903 (https://github.com/angular/protractor/commit/2a765c76e121de13ff86a279fe3f21cb15c17783)\r\nwas causing ElementArrayFinder.prototype.count to be slow because of\r\nthe extranous checks that must be performed. However, the checks could be\r\ndelayed into the isPresent check, which will mitigate this issue\r\n\r\nfixes(#2359)","created_at":"2015-07-20T20:43:07Z","updated_at":"2015-07-20T21:42:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b8251f13a3e529f046410edbff7b916eeb37eda","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/angular/protractor/pulls/2364/commits","review_comments_url":"https://api.github.com/repos/angular/protractor/pulls/2364/comments","review_comment_url":"https://api.github.com/repos/angular/protractor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/protractor/issues/2364/comments","statuses_url":"https://api.github.com/repos/angular/protractor/statuses/99a2f5917459445e37775d2b849162e298bbbe42","head":{"label":"hankduan:fixCount","ref":"fixCount","sha":"99a2f5917459445e37775d2b849162e298bbbe42","user":{"login":"hankduan","id":1059345,"avatar_url":"https://avatars.githubusercontent.com/u/1059345?v=3","gravatar_id":"","url":"https://api.github.com/users/hankduan","html_url":"https://github.com/hankduan","followers_url":"https://api.github.com/users/hankduan/followers","following_url":"https://api.github.com/users/hankduan/following{/other_user}","gists_url":"https://api.github.com/users/hankduan/gists{/gist_id}","starred_url":"https://api.github.com/users/hankduan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hankduan/subscriptions","organizations_url":"https://api.github.com/users/hankduan/orgs","repos_url":"https://api.github.com/users/hankduan/repos","events_url":"https://api.github.com/users/hankduan/events{/privacy}","received_events_url":"https://api.github.com/users/hankduan/received_events","type":"User","site_admin":false},"repo":{"id":18743630,"name":"protractor","full_name":"hankduan/protractor","owner":{"login":"hankduan","id":1059345,"avatar_url":"https://avatars.githubusercontent.com/u/1059345?v=3","gravatar_id":"","url":"https://api.github.com/users/hankduan","html_url":"https://github.com/hankduan","followers_url":"https://api.github.com/users/hankduan/followers","following_url":"https://api.github.com/users/hankduan/following{/other_user}","gists_url":"https://api.github.com/users/hankduan/gists{/gist_id}","starred_url":"https://api.github.com/users/hankduan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hankduan/subscriptions","organizations_url":"https://api.github.com/users/hankduan/orgs","repos_url":"https://api.github.com/users/hankduan/repos","events_url":"https://api.github.com/users/hankduan/events{/privacy}","received_events_url":"https://api.github.com/users/hankduan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hankduan/protractor","description":"E2E test framework for Angular apps","fork":true,"url":"https://api.github.com/repos/hankduan/protractor","forks_url":"https://api.github.com/repos/hankduan/protractor/forks","keys_url":"https://api.github.com/repos/hankduan/protractor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hankduan/protractor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hankduan/protractor/teams","hooks_url":"https://api.github.com/repos/hankduan/protractor/hooks","issue_events_url":"https://api.github.com/repos/hankduan/protractor/issues/events{/number}","events_url":"https://api.github.com/repos/hankduan/protractor/events","assignees_url":"https://api.github.com/repos/hankduan/protractor/assignees{/user}","branches_url":"https://api.github.com/repos/hankduan/protractor/branches{/branch}","tags_url":"https://api.github.com/repos/hankduan/protractor/tags","blobs_url":"https://api.github.com/repos/hankduan/protractor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hankduan/protractor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hankduan/protractor/git/refs{/sha}","trees_url":"https://api.github.com/repos/hankduan/protractor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hankduan/protractor/statuses/{sha}","languages_url":"https://api.github.com/repos/hankduan/protractor/languages","stargazers_url":"https://api.github.com/repos/hankduan/protractor/stargazers","contributors_url":"https://api.github.com/repos/hankduan/protractor/contributors","subscribers_url":"https://api.github.com/repos/hankduan/protractor/subscribers","subscription_url":"https://api.github.com/repos/hankduan/protractor/subscription","commits_url":"https://api.github.com/repos/hankduan/protractor/commits{/sha}","git_commits_url":"https://api.github.com/repos/hankduan/protractor/git/commits{/sha}","comments_url":"https://api.github.com/repos/hankduan/protractor/comments{/number}","issue_comment_url":"https://api.github.com/repos/hankduan/protractor/issues/comments{/number}","contents_url":"https://api.github.com/repos/hankduan/protractor/contents/{+path}","compare_url":"https://api.github.com/repos/hankduan/protractor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hankduan/protractor/merges","archive_url":"https://api.github.com/repos/hankduan/protractor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hankduan/protractor/downloads","issues_url":"https://api.github.com/repos/hankduan/protractor/issues{/number}","pulls_url":"https://api.github.com/repos/hankduan/protractor/pulls{/number}","milestones_url":"https://api.github.com/repos/hankduan/protractor/milestones{/number}","notifications_url":"https://api.github.com/repos/hankduan/protractor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hankduan/protractor/labels{/name}","releases_url":"https://api.github.com/repos/hankduan/protractor/releases{/id}","created_at":"2014-04-14T00:28:37Z","updated_at":"2015-03-11T05:28:01Z","pushed_at":"2015-07-20T20:41:42Z","git_url":"git://github.com/hankduan/protractor.git","ssh_url":"git@github.com:hankduan/protractor.git","clone_url":"https://github.com/hankduan/protractor.git","svn_url":"https://github.com/hankduan/protractor","homepage":null,"size":4532,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"69404aaee833f41de62eaa3112957659d21094a3","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":7639232,"name":"protractor","full_name":"angular/protractor","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/protractor","description":"E2E test framework for Angular apps","fork":false,"url":"https://api.github.com/repos/angular/protractor","forks_url":"https://api.github.com/repos/angular/protractor/forks","keys_url":"https://api.github.com/repos/angular/protractor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/protractor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/protractor/teams","hooks_url":"https://api.github.com/repos/angular/protractor/hooks","issue_events_url":"https://api.github.com/repos/angular/protractor/issues/events{/number}","events_url":"https://api.github.com/repos/angular/protractor/events","assignees_url":"https://api.github.com/repos/angular/protractor/assignees{/user}","branches_url":"https://api.github.com/repos/angular/protractor/branches{/branch}","tags_url":"https://api.github.com/repos/angular/protractor/tags","blobs_url":"https://api.github.com/repos/angular/protractor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/protractor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/protractor/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/protractor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/protractor/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/protractor/languages","stargazers_url":"https://api.github.com/repos/angular/protractor/stargazers","contributors_url":"https://api.github.com/repos/angular/protractor/contributors","subscribers_url":"https://api.github.com/repos/angular/protractor/subscribers","subscription_url":"https://api.github.com/repos/angular/protractor/subscription","commits_url":"https://api.github.com/repos/angular/protractor/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/protractor/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/protractor/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/protractor/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/protractor/contents/{+path}","compare_url":"https://api.github.com/repos/angular/protractor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/protractor/merges","archive_url":"https://api.github.com/repos/angular/protractor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/protractor/downloads","issues_url":"https://api.github.com/repos/angular/protractor/issues{/number}","pulls_url":"https://api.github.com/repos/angular/protractor/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/protractor/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/protractor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/protractor/labels{/name}","releases_url":"https://api.github.com/repos/angular/protractor/releases{/id}","created_at":"2013-01-16T04:30:53Z","updated_at":"2015-07-20T18:49:18Z","pushed_at":"2015-07-20T20:43:08Z","git_url":"git://github.com/angular/protractor.git","ssh_url":"git@github.com:angular/protractor.git","clone_url":"https://github.com/angular/protractor.git","svn_url":"https://github.com/angular/protractor","homepage":"http://www.protractortest.org","size":11419,"stargazers_count":4125,"watchers_count":4125,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":840,"mirror_url":null,"open_issues_count":183,"forks":840,"open_issues":183,"watchers":4125,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/protractor/pulls/2364"},"html":{"href":"https://github.com/angular/protractor/pull/2364"},"issue":{"href":"https://api.github.com/repos/angular/protractor/issues/2364"},"comments":{"href":"https://api.github.com/repos/angular/protractor/issues/2364/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/protractor/pulls/2364/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/protractor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/protractor/pulls/2364/commits"},"statuses":{"href":"https://api.github.com/repos/angular/protractor/statuses/99a2f5917459445e37775d2b849162e298bbbe42"}}}}