1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-10 15:44:51 +02:00

some cleaning and changes for readability

This commit is contained in:
Johann-S
2018-11-14 10:16:56 +01:00
parent fab1dea927
commit 9201a80510
12 changed files with 285 additions and 296 deletions

View File

@@ -1,6 +1,3 @@
import $ from 'jquery'
import Util from './util'
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.1.3): tab.js
@@ -8,6 +5,9 @@ import Util from './util'
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
@@ -141,17 +141,12 @@ class Tab {
// Private
_activate(element, container, callback) {
let activeElements
if (container && container.nodeName === 'UL') {
activeElements = $(container).find(Selector.ACTIVE_UL)
} else {
activeElements = $(container).children(Selector.ACTIVE)
}
const activeElements = container && container.nodeName === 'UL'
? $(container).find(Selector.ACTIVE_UL)
: $(container).children(Selector.ACTIVE)
const active = activeElements[0]
const isTransitioning = callback &&
(active && $(active).hasClass(ClassName.FADE))
const isTransitioning = callback && (active && $(active).hasClass(ClassName.FADE))
const complete = () => this._transitionComplete(
element,
active,
@@ -195,11 +190,12 @@ class Tab {
Util.reflow(element)
$(element).addClass(ClassName.SHOW)
if (element.parentNode &&
$(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
const dropdownElement = $(element).closest(Selector.DROPDOWN)[0]
if (dropdownElement) {
const dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE))
$(dropdownToggleList).addClass(ClassName.ACTIVE)
}