aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/src/collapse.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/src/collapse.js')
-rw-r--r--vendor/twbs/bootstrap/js/src/collapse.js73
1 files changed, 37 insertions, 36 deletions
diff --git a/vendor/twbs/bootstrap/js/src/collapse.js b/vendor/twbs/bootstrap/js/src/collapse.js
index 9e501e085..0ec037704 100644
--- a/vendor/twbs/bootstrap/js/src/collapse.js
+++ b/vendor/twbs/bootstrap/js/src/collapse.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.5.2): collapse.js
+ * Bootstrap (v4.5.3): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -14,38 +14,38 @@ import Util from './util'
* ------------------------------------------------------------------------
*/
-const NAME = 'collapse'
-const VERSION = '4.5.2'
-const DATA_KEY = 'bs.collapse'
-const EVENT_KEY = `.${DATA_KEY}`
-const DATA_API_KEY = '.data-api'
-const JQUERY_NO_CONFLICT = $.fn[NAME]
+const NAME = 'collapse'
+const VERSION = '4.5.3'
+const DATA_KEY = 'bs.collapse'
+const EVENT_KEY = `.${DATA_KEY}`
+const DATA_API_KEY = '.data-api'
+const JQUERY_NO_CONFLICT = $.fn[NAME]
const Default = {
- toggle : true,
- parent : ''
+ toggle: true,
+ parent: ''
}
const DefaultType = {
- toggle : 'boolean',
- parent : '(string|element)'
+ toggle: 'boolean',
+ parent: '(string|element)'
}
-const EVENT_SHOW = `show${EVENT_KEY}`
-const EVENT_SHOWN = `shown${EVENT_KEY}`
-const EVENT_HIDE = `hide${EVENT_KEY}`
-const EVENT_HIDDEN = `hidden${EVENT_KEY}`
+const EVENT_SHOW = `show${EVENT_KEY}`
+const EVENT_SHOWN = `shown${EVENT_KEY}`
+const EVENT_HIDE = `hide${EVENT_KEY}`
+const EVENT_HIDDEN = `hidden${EVENT_KEY}`
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
-const CLASS_NAME_SHOW = 'show'
-const CLASS_NAME_COLLAPSE = 'collapse'
+const CLASS_NAME_SHOW = 'show'
+const CLASS_NAME_COLLAPSE = 'collapse'
const CLASS_NAME_COLLAPSING = 'collapsing'
-const CLASS_NAME_COLLAPSED = 'collapsed'
+const CLASS_NAME_COLLAPSED = 'collapsed'
-const DIMENSION_WIDTH = 'width'
+const DIMENSION_WIDTH = 'width'
const DIMENSION_HEIGHT = 'height'
-const SELECTOR_ACTIVES = '.show, .collapsing'
+const SELECTOR_ACTIVES = '.show, .collapsing'
const SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]'
/**
@@ -57,9 +57,9 @@ const SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]'
class Collapse {
constructor(element, config) {
this._isTransitioning = false
- this._element = element
- this._config = this._getConfig(config)
- this._triggerArray = [].slice.call(document.querySelectorAll(
+ this._element = element
+ this._config = this._getConfig(config)
+ this._triggerArray = [].slice.call(document.querySelectorAll(
`[data-toggle="collapse"][href="#${element.id}"],` +
`[data-toggle="collapse"][data-target="#${element.id}"]`
))
@@ -69,7 +69,7 @@ class Collapse {
const elem = toggleList[i]
const selector = Util.getSelectorFromElement(elem)
const filterElement = [].slice.call(document.querySelectorAll(selector))
- .filter((foundElem) => foundElem === element)
+ .filter(foundElem => foundElem === element)
if (selector !== null && filterElement.length > 0) {
this._selector = selector
@@ -119,7 +119,7 @@ class Collapse {
if (this._parent) {
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES))
- .filter((elem) => {
+ .filter(elem => {
if (typeof this._config.parent === 'string') {
return elem.getAttribute('data-parent') === this._config.parent
}
@@ -254,10 +254,10 @@ class Collapse {
dispose() {
$.removeData(this._element, DATA_KEY)
- this._config = null
- this._parent = null
- this._element = null
- this._triggerArray = null
+ this._config = null
+ this._parent = null
+ this._element = null
+ this._triggerArray = null
this._isTransitioning = null
}
@@ -324,12 +324,12 @@ class Collapse {
static _jQueryInterface(config) {
return this.each(function () {
- const $this = $(this)
- let data = $this.data(DATA_KEY)
+ const $element = $(this)
+ let data = $element.data(DATA_KEY)
const _config = {
...Default,
- ...$this.data(),
- ...typeof config === 'object' && config ? config : {}
+ ...$element.data(),
+ ...(typeof config === 'object' && config ? config : {})
}
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
@@ -338,13 +338,14 @@ class Collapse {
if (!data) {
data = new Collapse(this, _config)
- $this.data(DATA_KEY, data)
+ $element.data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
+
data[config]()
}
})
@@ -369,8 +370,8 @@ $(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
$(selectors).each(function () {
const $target = $(this)
- const data = $target.data(DATA_KEY)
- const config = data ? 'toggle' : $trigger.data()
+ const data = $target.data(DATA_KEY)
+ const config = data ? 'toggle' : $trigger.data()
Collapse._jQueryInterface.call($target, config)
})
})