Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-06-10 02:36:35 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-07-29 16:30:02 +0300
commit7a71703fd345879d2c60bf32bd934e605bde8c4c (patch)
tree7caabfa2c7e0b05f0b6e1d95c9fb464ea82cc828 /js/src/collapse.js
parent8fc4f3aaf3598426c9077530949bac4fc3653f87 (diff)
Simplify check for children
Diffstat (limited to 'js/src/collapse.js')
-rw-r--r--js/src/collapse.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js
index 58de34c1cf..21ee5cceec 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -129,14 +129,8 @@ class Collapse extends BaseComponent {
let activesData
if (this._parent) {
- actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent)
- .filter(elem => {
- if (typeof this._config.parent === 'string') {
- return elem.getAttribute('data-bs-parent') === this._config.parent
- }
-
- return elem.classList.contains(CLASS_NAME_COLLAPSE)
- })
+ const children = SelectorEngine.find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._parent)
+ actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => !children.includes(elem)) // remove children if greater depth
}
const container = SelectorEngine.findOne(this._selector)