mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-30 22:52:24 +01:00
Simplify check for children
This commit is contained in:
parent
8fc4f3aaf3
commit
7a71703fd3
@ -129,14 +129,8 @@ class Collapse extends BaseComponent {
|
||||
let activesData
|
||||
|
||||
if (this._parent) {
|
||||
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent)
|
||||
.filter(elem => {
|
||||
if (typeof this._config.parent === 'string') {
|
||||
return elem.getAttribute('data-bs-parent') === this._config.parent
|
||||
}
|
||||
|
||||
return elem.classList.contains(CLASS_NAME_COLLAPSE)
|
||||
})
|
||||
const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._parent)
|
||||
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => !children.includes(elem)) // remove children if greater depth
|
||||
}
|
||||
|
||||
const container = SelectorEngine.findOne(this._selector)
|
||||
|
Loading…
x
Reference in New Issue
Block a user