aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2017-08-11 15:14:48 +0300
committerGitHub <[email protected]>2017-08-11 15:14:48 +0300
commit3820fd1ce792af70de7703db55ea914811f9b72a (patch)
treedd1db86505af301e3816cfc89deb6c4e7fe20663 /js/src
parent10bb79a250b72c3e6c2b010aa0d9c01192b1a533 (diff)
parent2eb1e687bd74d147145000b3971821cc890d7652 (diff)
downloadbootstrap-3820fd1ce792af70de7703db55ea914811f9b72a.tar.xz
bootstrap-3820fd1ce792af70de7703db55ea914811f9b72a.zip
Merge pull request #23087 from twbs/v4-dev-xmr-tabs-fix
tabs: fix nested tabs.
Diffstat (limited to 'js/src')
-rw-r--r--js/src/tab.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/js/src/tab.js b/js/src/tab.js
index 1613bbb7d..4c3091495 100644
--- a/js/src/tab.js
+++ b/js/src/tab.js
@@ -45,6 +45,7 @@ const Tab = (($) => {
DROPDOWN : '.dropdown',
NAV_LIST_GROUP : '.nav, .list-group',
ACTIVE : '.active',
+ ACTIVE_UL : '> li > .active',
DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
DROPDOWN_TOGGLE : '.dropdown-toggle',
DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active'
@@ -87,7 +88,8 @@ const Tab = (($) => {
const selector = Util.getSelectorFromElement(this._element)
if (listElement) {
- previous = $.makeArray($(listElement).find(Selector.ACTIVE))
+ const itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE
+ previous = $.makeArray($(listElement).find(itemSelector))
previous = previous[previous.length - 1]
}
@@ -148,7 +150,14 @@ const Tab = (($) => {
// private
_activate(element, container, callback) {
- const active = $(container).find(Selector.ACTIVE)[0]
+ let activeElements
+ if (container.nodeName === 'UL') {
+ activeElements = $(container).find(Selector.ACTIVE_UL)
+ } else {
+ activeElements = $(container).children(Selector.ACTIVE)
+ }
+
+ const active = activeElements[0]
const isTransitioning = callback
&& Util.supportsTransitionEnd()
&& (active && $(active).hasClass(ClassName.FADE))