diff options
| author | Pierre Vanduynslager <[email protected]> | 2017-04-25 03:32:14 -0400 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2017-04-25 09:32:14 +0200 |
| commit | ab39defe74914109df164c823af927de68320d55 (patch) | |
| tree | 0b6fd0360c1a8db58367074770d2dd6859349ef5 /js/src | |
| parent | ba312c20a5ceca42117dd53303bafda485d8facd (diff) | |
| download | bootstrap-ab39defe74914109df164c823af927de68320d55.tar.xz bootstrap-ab39defe74914109df164c823af927de68320d55.zip | |
Detach accordion from card without requiring 'data-children'
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/collapse.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js index dec272297..bf1c738f5 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -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 } |
