mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-07 04:54:24 +01:00
Optimize jQueryInterface in Collapse (#35689)
extracts config initialization from cycle
This commit is contained in:
parent
77e02a07c7
commit
a805330f63
@ -256,12 +256,12 @@ class Collapse extends BaseComponent {
|
|||||||
|
|
||||||
// Static
|
// Static
|
||||||
static jQueryInterface(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
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
return this.each(function () {
|
||||||
const data = Collapse.getOrCreateInstance(this, _config)
|
const data = Collapse.getOrCreateInstance(this, _config)
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user