]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Remove `SelectorEngine.matches()`. (#32339)
authorXhmikosR <xhmikosr@gmail.com>
Mon, 7 Dec 2020 17:10:20 +0000 (19:10 +0200)
committerGitHub <noreply@github.com>
Mon, 7 Dec 2020 17:10:20 +0000 (19:10 +0200)
It's basically unused.

js/src/dom/selector-engine.js
js/tests/unit/dom/selector-engine.spec.js

index 3c407667c9578fa91114bdf085afd6942ad5cb91..727df751890297dccd57604b38484118e4fb1660 100644 (file)
 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]
       }
 
index 781d0ce1b5cb05ce9f1d92eb35a25d9af9345552..d108a2efbf7e57ed479b4d6e0d5cb58e8f25f9ca 100644 (file)
@@ -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>'