0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

Remove SelectorEngine.matches(). (#32339)

It's basically unused.
This commit is contained in:
XhmikosR 2020-12-07 19:10:20 +02:00 committed by GitHub
parent 33b275c04b
commit d15a0247ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 14 deletions

View File

@ -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]
}

View 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>'