mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-29 23:09:05 +02:00
Collapse - Allow to pass jQuery object or DOM element to the parent option
This commit is contained in:
@@ -33,7 +33,7 @@ const Collapse = (() => {
|
||||
|
||||
const DefaultType = {
|
||||
toggle : 'boolean',
|
||||
parent : 'string'
|
||||
parent : '(string|element)'
|
||||
}
|
||||
|
||||
const Event = {
|
||||
@@ -289,7 +289,18 @@ const Collapse = (() => {
|
||||
}
|
||||
|
||||
_getParent() {
|
||||
const parent = $(this._config.parent)[0]
|
||||
let parent = null
|
||||
if (Util.isElement(this._config.parent)) {
|
||||
parent = this._config.parent
|
||||
|
||||
// it's a jQuery object
|
||||
if (typeof this._config.parent.jquery !== 'undefined') {
|
||||
parent = this._config.parent[0]
|
||||
}
|
||||
} else {
|
||||
parent = $(this._config.parent)[0]
|
||||
}
|
||||
|
||||
const selector =
|
||||
`[data-toggle="collapse"][data-parent="${this._config.parent}"]`
|
||||
|
||||
|
Reference in New Issue
Block a user