]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
scrollspy: fix wrong activation of all nested links (#20304)
authormr-july <mr_july@mail.ru>
Fri, 23 Dec 2016 06:00:56 +0000 (07:00 +0100)
committerMark Otto <markd.otto@gmail.com>
Fri, 23 Dec 2016 06:00:56 +0000 (22:00 -0800)
* fix wrong activation of all nested links;
just first level item should be activated

* use template instead of string concatenation

js/src/scrollspy.js

index 9cb1438ca79a12a0a3badd76da05f5c3e2d6c606..0a4708bf972a5face425fbba1ba199689de42fec 100644 (file)
@@ -258,7 +258,7 @@ const ScrollSpy = (($) => {
       } else {
         // todo (fat) this is kinda sus...
         // recursively add actives to tested nav-links
-        $link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE)
+        $link.parents(Selector.LI).find(`> ${Selector.NAV_LINKS}`).addClass(ClassName.ACTIVE)
       }
 
       $(this._scrollElement).trigger(Event.ACTIVATE, {