{"action":"created","comment":{"url":"https://api.github.com/repos/twbs/bootstrap/pulls/comments/25555169","id":25555169,"diff_hunk":"@@ -142,6 +142,48 @@ $(function () {\n       .then(function () { return testElementIsActiveAfterScroll('#li-2', '#div-2') })\n   })\n \n+  QUnit.test('should add the active class correctly when there are nested elements at 0 scroll offset', function (assert) {\n+    var navbarHtml =\n+        '<nav class=\"navbar\">'\n+      + '<ul class=\"nav\">'\n+      + '<li id=\"li-1\"><a href=\"#div-1\">div 1</a>'\n+      + '<ul>'\n+      + '<li id=\"li-2\"><a href=\"#div-2\">div 2</a></li>'\n+      + '</ul>'\n+      + '</li>'\n+      + '</ul>'\n+      + '</nav>'\n+    var contentHtml =\n+        '<div class=\"content\" style=\"position: absolute; top: 0px; overflow: auto; height: 50px\">'\n+      + '<div id=\"div-1\" style=\"padding: 0; margin: 0\">'\n+      + '<div id=\"div-2\" style=\"height: 200px; padding: 0; margin: 0\">div 2</div>'\n+      + '</div>'\n+      + '</div>'\n+\n+    $(navbarHtml).appendTo('#qunit-fixture')\n+    var $content = $(contentHtml)\n+      .appendTo('#qunit-fixture')\n+      .bootstrapScrollspy({ offset: 0, target: '.navbar' })\n+\n+    var testElementsAreActiveAfterScroll = function (element) {\n+      var deferred = $.Deferred()\n+      var scrollHeight = $content.scrollTop() + 10\n+      var done = assert.async()\n+      $content.one('scroll', function () {\n+        assert.ok($('#li-1').hasClass('active'), 'element' + element)\n+        assert.ok($('#li-2').hasClass('active'), 'element' + element)\n+        done()\n+        deferred.resolve()\n+      })\n+      $content.scrollTop(scrollHeight)\n+      return deferred.promise()\n+    }\n+\n+    $.when(testElementsAreActiveAfterScroll())\n+      .then(function () { return testElementsAreActiveAfterScroll() })","path":"js/tests/unit/scrollspy.js","position":42,"original_position":42,"commit_id":"010d8d2482909a9316449b060f276e687418b1ad","original_commit_id":"010d8d2482909a9316449b060f276e687418b1ad","user":{"login":"cvrebert","id":419884,"avatar_url":"https://avatars.githubusercontent.com/u/419884?v=3","gravatar_id":"","url":"https://api.github.com/users/cvrebert","html_url":"https://github.com/cvrebert","followers_url":"https://api.github.com/users/cvrebert/followers","following_url":"https://api.github.com/users/cvrebert/following{/other_user}","gists_url":"https://api.github.com/users/cvrebert/gists{/gist_id}","starred_url":"https://api.github.com/users/cvrebert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvrebert/subscriptions","organizations_url":"https://api.github.com/users/cvrebert/orgs","repos_url":"https://api.github.com/users/cvrebert/repos","events_url":"https://api.github.com/users/cvrebert/events{/privacy}","received_events_url":"https://api.github.com/users/cvrebert/received_events","type":"User","site_admin":false},"body":"Since it's a function instead of a method, can't this be simplified to:\r\n`.then(testElementsAreActiveAfterScroll)`\r\n?","created_at":"2015-02-28T07:10:08Z","updated_at":"2015-02-28T07:10:08Z","html_url":"https://github.com/twbs/bootstrap/pull/15593#discussion_r25555169","pull_request_url":"https://api.github.com/repos/twbs/bootstrap/pulls/15593","_links":{"self":{"href":"https://api.github.com/repos/twbs/bootstrap/pulls/comments/25555169"},"html":{"href":"https://github.com/twbs/bootstrap/pull/15593#discussion_r25555169"},"pull_request":{"href":"https://api.github.com/repos/twbs/bootstrap/pulls/15593"}}},"pull_request":{"url":"https://api.github.com/repos/twbs/bootstrap/pulls/15593","id":27557318,"html_url":"https://github.com/twbs/bootstrap/pull/15593","diff_url":"https://github.com/twbs/bootstrap/pull/15593.diff","patch_url":"https://github.com/twbs/bootstrap/pull/15593.patch","issue_url":"https://api.github.com/repos/twbs/bootstrap/issues/15593","number":15593,"state":"open","locked":false,"title":"Handle multiple zero-offset Scrollspy elements.","user":{"login":"neoeno","id":1007202,"avatar_url":"https://avatars.githubusercontent.com/u/1007202?v=3","gravatar_id":"","url":"https://api.github.com/users/neoeno","html_url":"https://github.com/neoeno","followers_url":"https://api.github.com/users/neoeno/followers","following_url":"https://api.github.com/users/neoeno/following{/other_user}","gists_url":"https://api.github.com/users/neoeno/gists{/gist_id}","starred_url":"https://api.github.com/users/neoeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoeno/subscriptions","organizations_url":"https://api.github.com/users/neoeno/orgs","repos_url":"https://api.github.com/users/neoeno/repos","events_url":"https://api.github.com/users/neoeno/events{/privacy}","received_events_url":"https://api.github.com/users/neoeno/received_events","type":"User","site_admin":false},"body":"When the first two elements tracked by Scrollspy have an `offset.top` of 0, Scrollspy will flip between activating their respective nav events on every scroll event. This causes a visual 'flicker', and heavily degrades scroll performance.\r\n\r\nExamples:\r\n[Minimal example.](http://jsbin.com/lofaxoziha/5)\r\n[Example with nested sections.](http://jsbin.com/lofaxoziha/4)\r\n\r\nI saw this happen in a system of nested sections positioned hard against the top of the document, e.g.\r\n\r\n```\r\n<section id=\"animals\">\r\n  <section id=\"dogs\">\r\n\tContent\r\n  </section>\r\n</section>\r\n```\r\n\r\nThe bug is that Scrollspy's check to see if it's at the end of the array of sections uses `!arr[index + 1]`. This misses the case where `arr[index + 1]` does exist and is zero.\r\n\r\nThis commit explicitly checks the array bounds. A unit test is included, but I'm not familiar with bootstrap's testing approach so feedback is appreciated.\r\n\r\n(Thanks go to @theroux and @tnguyen14!)","created_at":"2015-01-17T14:24:45Z","updated_at":"2015-02-28T07:10:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cf5c2a58e941ab29fd67dfb9a0f9a94f2a516f6","assignee":null,"milestone":{"url":"https://api.github.com/repos/twbs/bootstrap/milestones/30","html_url":"https://github.com/twbs/bootstrap/milestones/v3.3.4","labels_url":"https://api.github.com/repos/twbs/bootstrap/milestones/30/labels","id":927525,"number":30,"title":"v3.3.4","description":"Skipping over v3.3.3 due to\r\nhttps://github.com/twbs/bootstrap-sass/commit/107ca189e406bbe314eb84f0372ed3706b81c761","creator":{"login":"cvrebert","id":419884,"avatar_url":"https://avatars.githubusercontent.com/u/419884?v=3","gravatar_id":"","url":"https://api.github.com/users/cvrebert","html_url":"https://github.com/cvrebert","followers_url":"https://api.github.com/users/cvrebert/followers","following_url":"https://api.github.com/users/cvrebert/following{/other_user}","gists_url":"https://api.github.com/users/cvrebert/gists{/gist_id}","starred_url":"https://api.github.com/users/cvrebert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvrebert/subscriptions","organizations_url":"https://api.github.com/users/cvrebert/orgs","repos_url":"https://api.github.com/users/cvrebert/repos","events_url":"https://api.github.com/users/cvrebert/events{/privacy}","received_events_url":"https://api.github.com/users/cvrebert/received_events","type":"User","site_admin":false},"open_issues":41,"closed_issues":109,"state":"open","created_at":"2015-01-08T19:01:33Z","updated_at":"2015-02-27T07:49:10Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/twbs/bootstrap/pulls/15593/commits","review_comments_url":"https://api.github.com/repos/twbs/bootstrap/pulls/15593/comments","review_comment_url":"https://api.github.com/repos/twbs/bootstrap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twbs/bootstrap/issues/15593/comments","statuses_url":"https://api.github.com/repos/twbs/bootstrap/statuses/010d8d2482909a9316449b060f276e687418b1ad","head":{"label":"neoeno:handle_multiple_zero_offset_scrollspy_elements","ref":"handle_multiple_zero_offset_scrollspy_elements","sha":"010d8d2482909a9316449b060f276e687418b1ad","user":{"login":"neoeno","id":1007202,"avatar_url":"https://avatars.githubusercontent.com/u/1007202?v=3","gravatar_id":"","url":"https://api.github.com/users/neoeno","html_url":"https://github.com/neoeno","followers_url":"https://api.github.com/users/neoeno/followers","following_url":"https://api.github.com/users/neoeno/following{/other_user}","gists_url":"https://api.github.com/users/neoeno/gists{/gist_id}","starred_url":"https://api.github.com/users/neoeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoeno/subscriptions","organizations_url":"https://api.github.com/users/neoeno/orgs","repos_url":"https://api.github.com/users/neoeno/repos","events_url":"https://api.github.com/users/neoeno/events{/privacy}","received_events_url":"https://api.github.com/users/neoeno/received_events","type":"User","site_admin":false},"repo":{"id":29373314,"name":"bootstrap","full_name":"neoeno/bootstrap","owner":{"login":"neoeno","id":1007202,"avatar_url":"https://avatars.githubusercontent.com/u/1007202?v=3","gravatar_id":"","url":"https://api.github.com/users/neoeno","html_url":"https://github.com/neoeno","followers_url":"https://api.github.com/users/neoeno/followers","following_url":"https://api.github.com/users/neoeno/following{/other_user}","gists_url":"https://api.github.com/users/neoeno/gists{/gist_id}","starred_url":"https://api.github.com/users/neoeno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neoeno/subscriptions","organizations_url":"https://api.github.com/users/neoeno/orgs","repos_url":"https://api.github.com/users/neoeno/repos","events_url":"https://api.github.com/users/neoeno/events{/privacy}","received_events_url":"https://api.github.com/users/neoeno/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neoeno/bootstrap","description":"The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.","fork":true,"url":"https://api.github.com/repos/neoeno/bootstrap","forks_url":"https://api.github.com/repos/neoeno/bootstrap/forks","keys_url":"https://api.github.com/repos/neoeno/bootstrap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neoeno/bootstrap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neoeno/bootstrap/teams","hooks_url":"https://api.github.com/repos/neoeno/bootstrap/hooks","issue_events_url":"https://api.github.com/repos/neoeno/bootstrap/issues/events{/number}","events_url":"https://api.github.com/repos/neoeno/bootstrap/events","assignees_url":"https://api.github.com/repos/neoeno/bootstrap/assignees{/user}","branches_url":"https://api.github.com/repos/neoeno/bootstrap/branches{/branch}","tags_url":"https://api.github.com/repos/neoeno/bootstrap/tags","blobs_url":"https://api.github.com/repos/neoeno/bootstrap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neoeno/bootstrap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neoeno/bootstrap/git/refs{/sha}","trees_url":"https://api.github.com/repos/neoeno/bootstrap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neoeno/bootstrap/statuses/{sha}","languages_url":"https://api.github.com/repos/neoeno/bootstrap/languages","stargazers_url":"https://api.github.com/repos/neoeno/bootstrap/stargazers","contributors_url":"https://api.github.com/repos/neoeno/bootstrap/contributors","subscribers_url":"https://api.github.com/repos/neoeno/bootstrap/subscribers","subscription_url":"https://api.github.com/repos/neoeno/bootstrap/subscription","commits_url":"https://api.github.com/repos/neoeno/bootstrap/commits{/sha}","git_commits_url":"https://api.github.com/repos/neoeno/bootstrap/git/commits{/sha}","comments_url":"https://api.github.com/repos/neoeno/bootstrap/comments{/number}","issue_comment_url":"https://api.github.com/repos/neoeno/bootstrap/issues/comments{/number}","contents_url":"https://api.github.com/repos/neoeno/bootstrap/contents/{+path}","compare_url":"https://api.github.com/repos/neoeno/bootstrap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neoeno/bootstrap/merges","archive_url":"https://api.github.com/repos/neoeno/bootstrap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neoeno/bootstrap/downloads","issues_url":"https://api.github.com/repos/neoeno/bootstrap/issues{/number}","pulls_url":"https://api.github.com/repos/neoeno/bootstrap/pulls{/number}","milestones_url":"https://api.github.com/repos/neoeno/bootstrap/milestones{/number}","notifications_url":"https://api.github.com/repos/neoeno/bootstrap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neoeno/bootstrap/labels{/name}","releases_url":"https://api.github.com/repos/neoeno/bootstrap/releases{/id}","created_at":"2015-01-16T23:54:20Z","updated_at":"2015-01-16T23:54:28Z","pushed_at":"2015-02-27T12:55:56Z","git_url":"git://github.com/neoeno/bootstrap.git","ssh_url":"git@github.com:neoeno/bootstrap.git","clone_url":"https://github.com/neoeno/bootstrap.git","svn_url":"https://github.com/neoeno/bootstrap","homepage":"http://getbootstrap.com","size":76474,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"twbs:master","ref":"master","sha":"ad379ffb4a0fde7416ae076e68141300fc583018","user":{"login":"twbs","id":2918581,"avatar_url":"https://avatars.githubusercontent.com/u/2918581?v=3","gravatar_id":"","url":"https://api.github.com/users/twbs","html_url":"https://github.com/twbs","followers_url":"https://api.github.com/users/twbs/followers","following_url":"https://api.github.com/users/twbs/following{/other_user}","gists_url":"https://api.github.com/users/twbs/gists{/gist_id}","starred_url":"https://api.github.com/users/twbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twbs/subscriptions","organizations_url":"https://api.github.com/users/twbs/orgs","repos_url":"https://api.github.com/users/twbs/repos","events_url":"https://api.github.com/users/twbs/events{/privacy}","received_events_url":"https://api.github.com/users/twbs/received_events","type":"Organization","site_admin":false},"repo":{"id":2126244,"name":"bootstrap","full_name":"twbs/bootstrap","owner":{"login":"twbs","id":2918581,"avatar_url":"https://avatars.githubusercontent.com/u/2918581?v=3","gravatar_id":"","url":"https://api.github.com/users/twbs","html_url":"https://github.com/twbs","followers_url":"https://api.github.com/users/twbs/followers","following_url":"https://api.github.com/users/twbs/following{/other_user}","gists_url":"https://api.github.com/users/twbs/gists{/gist_id}","starred_url":"https://api.github.com/users/twbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twbs/subscriptions","organizations_url":"https://api.github.com/users/twbs/orgs","repos_url":"https://api.github.com/users/twbs/repos","events_url":"https://api.github.com/users/twbs/events{/privacy}","received_events_url":"https://api.github.com/users/twbs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twbs/bootstrap","description":"The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.","fork":false,"url":"https://api.github.com/repos/twbs/bootstrap","forks_url":"https://api.github.com/repos/twbs/bootstrap/forks","keys_url":"https://api.github.com/repos/twbs/bootstrap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twbs/bootstrap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twbs/bootstrap/teams","hooks_url":"https://api.github.com/repos/twbs/bootstrap/hooks","issue_events_url":"https://api.github.com/repos/twbs/bootstrap/issues/events{/number}","events_url":"https://api.github.com/repos/twbs/bootstrap/events","assignees_url":"https://api.github.com/repos/twbs/bootstrap/assignees{/user}","branches_url":"https://api.github.com/repos/twbs/bootstrap/branches{/branch}","tags_url":"https://api.github.com/repos/twbs/bootstrap/tags","blobs_url":"https://api.github.com/repos/twbs/bootstrap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twbs/bootstrap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twbs/bootstrap/git/refs{/sha}","trees_url":"https://api.github.com/repos/twbs/bootstrap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twbs/bootstrap/statuses/{sha}","languages_url":"https://api.github.com/repos/twbs/bootstrap/languages","stargazers_url":"https://api.github.com/repos/twbs/bootstrap/stargazers","contributors_url":"https://api.github.com/repos/twbs/bootstrap/contributors","subscribers_url":"https://api.github.com/repos/twbs/bootstrap/subscribers","subscription_url":"https://api.github.com/repos/twbs/bootstrap/subscription","commits_url":"https://api.github.com/repos/twbs/bootstrap/commits{/sha}","git_commits_url":"https://api.github.com/repos/twbs/bootstrap/git/commits{/sha}","comments_url":"https://api.github.com/repos/twbs/bootstrap/comments{/number}","issue_comment_url":"https://api.github.com/repos/twbs/bootstrap/issues/comments{/number}","contents_url":"https://api.github.com/repos/twbs/bootstrap/contents/{+path}","compare_url":"https://api.github.com/repos/twbs/bootstrap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twbs/bootstrap/merges","archive_url":"https://api.github.com/repos/twbs/bootstrap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twbs/bootstrap/downloads","issues_url":"https://api.github.com/repos/twbs/bootstrap/issues{/number}","pulls_url":"https://api.github.com/repos/twbs/bootstrap/pulls{/number}","milestones_url":"https://api.github.com/repos/twbs/bootstrap/milestones{/number}","notifications_url":"https://api.github.com/repos/twbs/bootstrap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twbs/bootstrap/labels{/name}","releases_url":"https://api.github.com/repos/twbs/bootstrap/releases{/id}","created_at":"2011-07-29T21:19:00Z","updated_at":"2015-02-28T06:48:13Z","pushed_at":"2015-02-27T07:51:18Z","git_url":"git://github.com/twbs/bootstrap.git","ssh_url":"git@github.com:twbs/bootstrap.git","clone_url":"https://github.com/twbs/bootstrap.git","svn_url":"https://github.com/twbs/bootstrap","homepage":"http://getbootstrap.com","size":167694,"stargazers_count":78164,"watchers_count":78164,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":30138,"mirror_url":null,"open_issues_count":125,"forks":30138,"open_issues":125,"watchers":78164,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/twbs/bootstrap/pulls/15593"},"html":{"href":"https://github.com/twbs/bootstrap/pull/15593"},"issue":{"href":"https://api.github.com/repos/twbs/bootstrap/issues/15593"},"comments":{"href":"https://api.github.com/repos/twbs/bootstrap/issues/15593/comments"},"review_comments":{"href":"https://api.github.com/repos/twbs/bootstrap/pulls/15593/comments"},"review_comment":{"href":"https://api.github.com/repos/twbs/bootstrap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twbs/bootstrap/pulls/15593/commits"},"statuses":{"href":"https://api.github.com/repos/twbs/bootstrap/statuses/010d8d2482909a9316449b060f276e687418b1ad"}}}}