aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2020-12-07 19:10:20 +0200
committerGitHub <[email protected]>2020-12-07 19:10:20 +0200
commitd15a0247ce444eb15f79b8bf76f2bc10f8eeb71a (patch)
treef8c7e71354afa3c4c8aad10937302032bffa3046
parent33b275c04b0957a830a6d3a57682ed216b18b887 (diff)
downloadbootstrap-d15a0247ce444eb15f79b8bf76f2bc10f8eeb71a.tar.xz
bootstrap-d15a0247ce444eb15f79b8bf76f2bc10f8eeb71a.zip
Remove `SelectorEngine.matches()`. (#32339)
It's basically unused.
-rw-r--r--js/src/dom/selector-engine.js8
-rw-r--r--js/tests/unit/dom/selector-engine.spec.js8
2 files changed, 2 insertions, 14 deletions
diff --git a/js/src/dom/selector-engine.js b/js/src/dom/selector-engine.js
index 3c407667c..727df7518 100644
--- a/js/src/dom/selector-engine.js
+++ b/js/src/dom/selector-engine.js
@@ -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))
},
@@ -38,7 +34,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 +62,7 @@ const SelectorEngine = {
let next = element.nextElementSibling
while (next) {
- if (this.matches(next, selector)) {
+ if (next.matches(selector)) {
return [next]
}
diff --git a/js/tests/unit/dom/selector-engine.spec.js b/js/tests/unit/dom/selector-engine.spec.js
index 781d0ce1b..d108a2efb 100644
--- a/js/tests/unit/dom/selector-engine.spec.js
+++ b/js/tests/unit/dom/selector-engine.spec.js
@@ -14,14 +14,6 @@ describe('SelectorEngine', () => {
clearFixture()
})
- describe('matches', () => {
- it('should return matched elements', () => {
- fixtureEl.innerHTML = '<div></div>'
-
- expect(SelectorEngine.matches(fixtureEl, 'div')).toEqual(true)
- })
- })
-
describe('find', () => {
it('should find elements', () => {
fixtureEl.innerHTML = '<div></div>'