diff options
Diffstat (limited to 'js/src/dom/selector-engine.js')
| -rw-r--r-- | js/src/dom/selector-engine.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/js/src/dom/selector-engine.js b/js/src/dom/selector-engine.js index b42c30c3f..116b02741 100644 --- a/js/src/dom/selector-engine.js +++ b/js/src/dom/selector-engine.js @@ -1,6 +1,6 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.0.0-alpha3): dom/selector-engine.js + * Bootstrap (v5.0.0-beta3): dom/selector-engine.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -14,10 +14,6 @@ const NODE_TEXT = 3 const SelectorEngine = { - matches(element, selector) { - return element.matches(selector) - }, - find(selector, element = document.documentElement) { return [].concat(...Element.prototype.querySelectorAll.call(element, selector)) }, @@ -27,9 +23,8 @@ const SelectorEngine = { }, children(element, selector) { - const children = [].concat(...element.children) - - return children.filter(child => child.matches(selector)) + return [].concat(...element.children) + .filter(child => child.matches(selector)) }, parents(element, selector) { @@ -38,7 +33,7 @@ const SelectorEngine = { let ancestor = element.parentNode while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { - if (this.matches(ancestor, selector)) { + if (ancestor.matches(selector)) { parents.push(ancestor) } @@ -66,7 +61,7 @@ const SelectorEngine = { let next = element.nextElementSibling while (next) { - if (this.matches(next, selector)) { + if (next.matches(selector)) { return [next] } |
