diff options
| author | GeoSot <[email protected]> | 2021-09-15 15:33:19 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-09-15 15:33:19 +0300 |
| commit | bdfb4cc54d29c0c7bcd7944d3c8de2e1cd41bb6c (patch) | |
| tree | d26f36b0b2ec5336b59f48a74bd43843d68c8036 /js/src/collapse.js | |
| parent | 8f2e6784241c8ca79ff84a7d8546a8b6b3b458bb (diff) | |
| download | bootstrap-bdfb4cc54d29c0c7bcd7944d3c8de2e1cd41bb6c.tar.xz bootstrap-bdfb4cc54d29c0c7bcd7944d3c8de2e1cd41bb6c.zip | |
Fix Collapse regression of handling toggling between sibling chilldren (#34951)
Diffstat (limited to 'js/src/collapse.js')
| -rw-r--r-- | js/src/collapse.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js index f38878f9b..edfc7ea85 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -50,6 +50,7 @@ const CLASS_NAME_SHOW = 'show' const CLASS_NAME_COLLAPSE = 'collapse' const CLASS_NAME_COLLAPSING = 'collapsing' const CLASS_NAME_COLLAPSED = 'collapsed' +const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}` const CLASS_NAME_HORIZONTAL = 'collapse-horizontal' const WIDTH = 'width' @@ -126,7 +127,7 @@ class Collapse extends BaseComponent { let activesData if (this._config.parent) { - const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent) + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent) actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)) // remove children if greater depth } @@ -253,7 +254,7 @@ class Collapse extends BaseComponent { return } - const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent) + const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent) SelectorEngine.find(SELECTOR_DATA_TOGGLE, this._config.parent).filter(elem => !children.includes(elem)) .forEach(element => { const selected = getElementFromSelector(element) |
