From 7a71703fd345879d2c60bf32bd934e605bde8c4c Mon Sep 17 00:00:00 2001 From: GeoSot Date: Thu, 10 Jun 2021 02:36:35 +0300 Subject: Simplify check for children --- js/src/collapse.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'js/src/collapse.js') 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) -- cgit v1.2.3