0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

collapse.js: minor refactoring.

This commit is contained in:
XhmikosR 2019-02-28 17:22:41 +02:00
parent 1393678f0b
commit 3ffe3a5d82

View File

@ -305,17 +305,15 @@ class Collapse {
}
_getParent() {
let parent
if (isElement(this._config.parent)) {
{ parent } = this._config
let { parent } = this._config
if (isElement(parent)) {
// it's a jQuery object
if (typeof this._config.parent.jquery !== 'undefined' || typeof this._config.parent[0] !== 'undefined') {
parent = this._config.parent[0]
if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
parent = parent[0]
}
} else {
parent = SelectorEngine.findOne(this._config.parent)
parent = SelectorEngine.findOne(parent)
}
const selector = `[data-toggle="collapse"][data-parent="${parent}"]`