mirror of https://github.com/twbs/bootstrap.git
transfer `interface` inside `jQueryInterface`
This commit is contained in:
parent
e5b606d242
commit
2bf32ad180
|
@ -147,7 +147,7 @@ class Collapse extends BaseComponent {
|
||||||
|
|
||||||
actives.forEach(elemActive => {
|
actives.forEach(elemActive => {
|
||||||
if (container !== elemActive) {
|
if (container !== elemActive) {
|
||||||
Collapse.collapseInterface(elemActive, 'hide')
|
Collapse.getOrCreateInstance(elemActive, { toggle: false }).hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activesData) {
|
if (!activesData) {
|
||||||
|
@ -282,13 +282,14 @@ class Collapse extends BaseComponent {
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
|
||||||
static collapseInterface(element, config) {
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
const _config = {}
|
const _config = {}
|
||||||
if (typeof config === 'string' && /show|hide/.test(config)) {
|
if (typeof config === 'string' && /show|hide/.test(config)) {
|
||||||
_config.toggle = false
|
_config.toggle = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = Collapse.getOrCreateInstance(element, _config)
|
const data = Collapse.getOrCreateInstance(this, _config)
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
|
@ -297,11 +298,6 @@ class Collapse extends BaseComponent {
|
||||||
|
|
||||||
data[config]()
|
data[config]()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static jQueryInterface(config) {
|
|
||||||
return this.each(function () {
|
|
||||||
Collapse.collapseInterface(this, config)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue