Skip to content

Commit

Permalink
Remove SelectorEngine.matches(). (#32339)
Browse files Browse the repository at this point in the history
It's basically unused.
  • Loading branch information
XhmikosR committed Dec 7, 2020
1 parent 33b275c commit d15a024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 2 additions & 6 deletions js/src/dom/selector-engine.js
Expand Up @@ -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))
},
Expand All @@ -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)
}

Expand Down Expand Up @@ -66,7 +62,7 @@ const SelectorEngine = {
let next = element.nextElementSibling

while (next) {
if (this.matches(next, selector)) {
if (next.matches(selector)) {
return [next]
}

Expand Down
8 changes: 0 additions & 8 deletions js/tests/unit/dom/selector-engine.spec.js
Expand Up @@ -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>'
Expand Down

0 comments on commit d15a024

Please sign in to comment.