mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-12 00:24:03 +02:00
Detach accordion from card without requiring 'data-children'
This commit is contained in:
committed by
Johann-S
parent
ba312c20a5
commit
ab39defe74
@@ -56,9 +56,8 @@ const Collapse = (($) => {
|
||||
}
|
||||
|
||||
const Selector = {
|
||||
ACTIVES : '.card > .show, .card > .collapsing',
|
||||
DATA_TOGGLE : '[data-toggle="collapse"]',
|
||||
DATA_CHILDREN : 'data-children'
|
||||
ACTIVES : '.show, .collapsing',
|
||||
DATA_TOGGLE : '[data-toggle="collapse"]'
|
||||
}
|
||||
|
||||
|
||||
@@ -78,20 +77,13 @@ const Collapse = (($) => {
|
||||
`[data-toggle="collapse"][href="#${element.id}"],` +
|
||||
`[data-toggle="collapse"][data-target="#${element.id}"]`
|
||||
))
|
||||
|
||||
this._parent = this._config.parent ? this._getParent() : null
|
||||
|
||||
if (!this._config.parent) {
|
||||
this._addAriaAndCollapsedClass(this._element, this._triggerArray)
|
||||
}
|
||||
|
||||
this._selectorActives = Selector.ACTIVES
|
||||
if (this._parent) {
|
||||
const childrenSelector = this._parent.hasAttribute(Selector.DATA_CHILDREN) ? this._parent.getAttribute(Selector.DATA_CHILDREN) : null
|
||||
if (childrenSelector !== null) {
|
||||
this._selectorActives = `${childrenSelector} > .show, ${childrenSelector} > .collapsing`
|
||||
}
|
||||
}
|
||||
|
||||
if (this._config.toggle) {
|
||||
this.toggle()
|
||||
}
|
||||
@@ -129,7 +121,7 @@ const Collapse = (($) => {
|
||||
let activesData
|
||||
|
||||
if (this._parent) {
|
||||
actives = $.makeArray($(this._parent).find(this._selectorActives))
|
||||
actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES))
|
||||
if (!actives.length) {
|
||||
actives = null
|
||||
}
|
||||
|
Reference in New Issue
Block a user