Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2017-12-16 15:00:38 +0300
committerXhmikosR <xhmikosr@gmail.com>2018-01-11 19:48:46 +0300
commit80d0943b95984bfaf4997d2198d467876d294bd8 (patch)
treefa2eb4c869753b6e20c771a928da460587f38fdf /js/src/tab.js
parent6d336502c7e26c4cc5b35f1d7a19c067b774cb1f (diff)
Comply to the new rules.
Diffstat (limited to 'js/src/tab.js')
-rw-r--r--js/src/tab.js40
1 files changed, 13 insertions, 27 deletions
diff --git a/js/src/tab.js b/js/src/tab.js
index e501568e7e..0ae060c468 100644
--- a/js/src/tab.js
+++ b/js/src/tab.js
@@ -1,7 +1,6 @@
import $ from 'jquery'
import Util from './util'
-
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-beta.3): tab.js
@@ -10,8 +9,6 @@ import Util from './util'
*/
const Tab = (($) => {
-
-
/**
* ------------------------------------------------------------------------
* Constants
@@ -52,7 +49,6 @@ const Tab = (($) => {
DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active'
}
-
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -60,20 +56,17 @@ const Tab = (($) => {
*/
class Tab {
-
constructor(element) {
this._element = element
}
-
- // getters
+ // Getters
static get VERSION() {
return VERSION
}
-
- // public
+ // Public
show() {
if (this._element.parentNode &&
@@ -86,7 +79,7 @@ const Tab = (($) => {
let target
let previous
const listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0]
- const selector = Util.getSelectorFromElement(this._element)
+ const selector = Util.getSelectorFromElement(this._element)
if (listElement) {
const itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE
@@ -147,8 +140,7 @@ const Tab = (($) => {
this._element = null
}
-
- // private
+ // Private
_activate(element, container, callback) {
let activeElements
@@ -158,10 +150,10 @@ const Tab = (($) => {
activeElements = $(container).children(Selector.ACTIVE)
}
- const active = activeElements[0]
- const isTransitioning = callback
- && Util.supportsTransitionEnd()
- && (active && $(active).hasClass(ClassName.FADE))
+ const active = activeElements[0]
+ const isTransitioning = callback &&
+ Util.supportsTransitionEnd() &&
+ (active && $(active).hasClass(ClassName.FADE))
const complete = () => this._transitionComplete(
element,
@@ -205,7 +197,6 @@ const Tab = (($) => {
if (element.parentNode &&
$(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
-
const dropdownElement = $(element).closest(Selector.DROPDOWN)[0]
if (dropdownElement) {
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE)
@@ -219,13 +210,12 @@ const Tab = (($) => {
}
}
-
- // static
+ // Static
static _jQueryInterface(config) {
return this.each(function () {
const $this = $(this)
- let data = $this.data(DATA_KEY)
+ let data = $this.data(DATA_KEY)
if (!data) {
data = new Tab(this)
@@ -234,16 +224,14 @@ const Tab = (($) => {
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
- throw new Error(`No method named "${config}"`)
+ throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
-
}
-
/**
* ------------------------------------------------------------------------
* Data Api implementation
@@ -256,22 +244,20 @@ const Tab = (($) => {
Tab._jQueryInterface.call($(this), 'show')
})
-
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
- $.fn[NAME] = Tab._jQueryInterface
+ $.fn[NAME] = Tab._jQueryInterface
$.fn[NAME].Constructor = Tab
- $.fn[NAME].noConflict = function () {
+ $.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Tab._jQueryInterface
}
return Tab
-
})($)
export default Tab