diff options
author | Johann <johann.servoire@gmail.com> | 2017-03-19 02:36:33 +0300 |
---|---|---|
committer | Mark Otto <markd.otto@gmail.com> | 2017-03-19 02:36:33 +0300 |
commit | 1a46d8c7309092566c2da8cbaa9999ae0a1bacc7 (patch) | |
tree | cba4fd518ad29333231f3934a2db3081cf8e3b68 /js/src/tab.js | |
parent | ab77282004a6534ed050d78b9699c84068de547a (diff) |
Allow to use Tab.js with list-group (#21756)
* Allow to use Tab.js with list-group
* Allow to use list-group with div parent instead of an ul parent
Diffstat (limited to 'js/src/tab.js')
-rw-r--r-- | js/src/tab.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/js/src/tab.js b/js/src/tab.js index c069b0a9a9..d5669b7ad0 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -45,10 +45,10 @@ const Tab = (($) => { A : 'a', LI : 'li', DROPDOWN : '.dropdown', - LIST : 'ul:not(.dropdown-menu), ol:not(.dropdown-menu), nav:not(.dropdown-menu)', - FADE_CHILD : '> .nav-item .fade, > .fade', + LIST : 'ul:not(.dropdown-menu), ol:not(.dropdown-menu), nav:not(.dropdown-menu), .list-group:not(.dropdown-menu)', + FADE_CHILD : '> .nav-item .fade, > .list-group-item .fade, > .fade', ACTIVE : '.active', - ACTIVE_CHILD : '> .nav-item > .active, > .active', + ACTIVE_CHILD : '> .nav-item > .active, > .list-group-item > .active, > .active', DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"]', DROPDOWN_TOGGLE : '.dropdown-toggle', DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active' @@ -182,6 +182,9 @@ const Tab = (($) => { _transitionComplete(element, active, isTransitioning, callback) { if (active) { $(active).removeClass(ClassName.ACTIVE) + if ($(active).hasClass('list-group-item')) { + $(active).find('a.nav-link').removeClass(ClassName.ACTIVE) + } const dropdownChild = $(active.parentNode).find( Selector.DROPDOWN_ACTIVE_CHILD @@ -195,6 +198,9 @@ const Tab = (($) => { } $(element).addClass(ClassName.ACTIVE) + if ($(element.parentNode).hasClass('list-group-item')) { + $(element.parentNode).addClass(ClassName.ACTIVE) + } element.setAttribute('aria-expanded', true) if (isTransitioning) { |