Skip to content

Instantly share code, notes, and snippets.

@dalgard
Last active February 20, 2018 22:47
Show Gist options
  • Save dalgard/7817372 to your computer and use it in GitHub Desktop.
Save dalgard/7817372 to your computer and use it in GitHub Desktop.
Cross-browser wrapper for element.matchesSelector
function matchesSelector(dom_element, selector) {
var matchesSelector = dom_element.matches || dom_element.matchesSelector || dom_element.webkitMatchesSelector || dom_element.mozMatchesSelector || dom_element.msM atchesSelector || dom_element.oMatchesSelector;
return matchesSelector.call(dom_element, selector);
}
@mcmimik
Copy link

mcmimik commented Feb 20, 2018

Typo in dom_element.msM atchesSelector — odd space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment