From 6c70c70f637267ca109f44ff63f564892ece42bf Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Sun, 17 Sep 2017 04:30:37 -0300 Subject: [PATCH] fix(scrollspy): Spying on nested navs fails to activate for .nav-link's inside nav-item's (#23967) * fix(scrollspy): Handle nested navs when nav-link inside nav-item * [scrolspy] Find only child .nav-link's inside .nav-item * [scrollspyt] Add tests for nested navs with nav-link inside nav-item * fix troy-o's in test --- js/src/scrollspy.js | 3 +++ js/tests/unit/scrollspy.js | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 70067c0b35..e8f0d3101b 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -54,6 +54,7 @@ const ScrollSpy = (() => { ACTIVE : '.active', NAV_LIST_GROUP : '.nav, .list-group', NAV_LINKS : '.nav-link', + NAV_ITEMS : '.nav-item', LIST_ITEMS : '.list-group-item', DROPDOWN : '.dropdown', DROPDOWN_ITEMS : '.dropdown-item', @@ -264,6 +265,8 @@ const ScrollSpy = (() => { // Set triggered links parents as active // With both