mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 08:34:08 +02:00
initialize variable properly
This commit is contained in:
@@ -125,7 +125,7 @@ class Collapse extends BaseComponent {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let actives
|
let actives = []
|
||||||
let activesData
|
let activesData
|
||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
@@ -137,14 +137,10 @@ class Collapse extends BaseComponent {
|
|||||||
|
|
||||||
return elem.classList.contains(CLASS_NAME_COLLAPSE)
|
return elem.classList.contains(CLASS_NAME_COLLAPSE)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (actives.length === 0) {
|
|
||||||
actives = null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const container = SelectorEngine.findOne(this._selector)
|
const container = SelectorEngine.findOne(this._selector)
|
||||||
if (actives) {
|
if (actives.length) {
|
||||||
const tempActiveData = actives.find(elem => container !== elem)
|
const tempActiveData = actives.find(elem => container !== elem)
|
||||||
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null
|
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null
|
||||||
|
|
||||||
@@ -158,17 +154,15 @@ class Collapse extends BaseComponent {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actives) {
|
actives.forEach(elemActive => {
|
||||||
actives.forEach(elemActive => {
|
if (container !== elemActive) {
|
||||||
if (container !== elemActive) {
|
Collapse.collapseInterface(elemActive, 'hide')
|
||||||
Collapse.collapseInterface(elemActive, 'hide')
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!activesData) {
|
if (!activesData) {
|
||||||
Data.set(elemActive, DATA_KEY, null)
|
Data.set(elemActive, DATA_KEY, null)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const dimension = this._getDimension()
|
const dimension = this._getDimension()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user