Forked from jonathantneal/matchesSelector.polyfill.js
Created
October 8, 2018 10:00
-
-
Save illvart/6dbfc9a8215575d1158db1a0b4ce3d4c to your computer and use it in GitHub Desktop.
matchesSelector Polyfill // returns whether an element matches a selector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.Element && function(ElementPrototype) { | |
ElementPrototype.matchesSelector = ElementPrototype.matchesSelector || | |
ElementPrototype.mozMatchesSelector || | |
ElementPrototype.msMatchesSelector || | |
ElementPrototype.oMatchesSelector || | |
ElementPrototype.webkitMatchesSelector || | |
function (selector) { | |
var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1; | |
while (nodes[++i] && nodes[i] != node); | |
return !!nodes[i]; | |
} | |
}(Element.prototype); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.Element&&function(e){e.matchesSelector=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector||function(e){var t=this,n=(t.parentNode||t.document).querySelectorAll(e),r=-1;while(n[++r]&&n[r]!=t);return!!n[r]}}(Element.prototype) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment