Skip to content

Instantly share code, notes, and snippets.

@nanotronic
Forked from rudiedirkx/matchesSelector.js
Last active August 29, 2015 14:07
Show Gist options
  • Save nanotronic/6a9a306cf6ee3f7b2c85 to your computer and use it in GitHub Desktop.
Save nanotronic/6a9a306cf6ee3f7b2c85 to your computer and use it in GitHub Desktop.
Element.prototype.matchesSelector || (Element.prototype.matchesSelector = Element.prototype.webkitMatchesSelector || Element.prototype.mozMatchesSelector || function(selecta) {
var els = document.querySelectorAll(selecta);
for ( var i=0, L=els.length; i<L; i++ ) {
if ( els[i] == this ) {
return true;
}
}
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment