1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 06:36:33 +02:00

transfer interface inside jQueryInterface

This commit is contained in:
GeoSot
2021-06-10 03:00:40 +03:00
committed by XhmikosR
parent e5b606d242
commit 2bf32ad180

View File

@@ -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)
}) })
} }
} }