diff options
| author | Patrick H. Lauke <[email protected]> | 2017-04-09 13:25:47 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-04-09 13:25:47 +0100 |
| commit | c5db196e7661259382efee35b5f1ea92fb5ae6d0 (patch) | |
| tree | 7f04a7f9d06df4aed196470882b458da849b7b03 /js/src/tab.js | |
| parent | 63cd4e96b3511853361b1c47dff05496e62c4e9a (diff) | |
| parent | 0719ab18887c5b7415b9042b3ac60008de593f9f (diff) | |
| download | bootstrap-c5db196e7661259382efee35b5f1ea92fb5ae6d0.tar.xz bootstrap-c5db196e7661259382efee35b5f1ea92fb5ae6d0.zip | |
Merge branch 'v4-dev' into v4-docs-button-group-a11y-patch1
Diffstat (limited to 'js/src/tab.js')
| -rw-r--r-- | js/src/tab.js | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/js/src/tab.js b/js/src/tab.js index d5669b7ad..6f8187d17 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -42,14 +42,10 @@ const Tab = (($) => { } const Selector = { - A : 'a', - LI : 'li', DROPDOWN : '.dropdown', - 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', + NAV_LIST_GROUP : '.nav, .list-group', ACTIVE : '.active', - ACTIVE_CHILD : '> .nav-item > .active, > .list-group-item > .active, > .active', - DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"]', + DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', DROPDOWN_TOGGLE : '.dropdown-toggle', DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active' } @@ -87,7 +83,7 @@ const Tab = (($) => { let target let previous - const listElement = $(this._element).closest(Selector.LIST)[0] + const listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0] const selector = Util.getSelectorFromElement(this._element) if (listElement) { @@ -152,11 +148,10 @@ const Tab = (($) => { // private _activate(element, container, callback) { - const active = $(container).find(Selector.ACTIVE_CHILD)[0] + const active = $(container).find(Selector.ACTIVE)[0] const isTransitioning = callback && Util.supportsTransitionEnd() - && (active && $(active).hasClass(ClassName.FADE) - || Boolean($(container).find(Selector.FADE_CHILD)[0])) + && (active && $(active).hasClass(ClassName.FADE)) const complete = () => this._transitionComplete( element, @@ -182,9 +177,6 @@ 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 @@ -198,9 +190,6 @@ 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) { |
