As of December 2020, all major browsers natively support .matches(). The last hold-out was IE11.
This repo is now in archive mode. Use
matches() for any future development.
matchesSelector( elem, selector ); // for example matchesSelector( myElem, 'div.my-hawt-selector' );
Install with Bower:
bower install matches-selector
Install with npm:
npm install desandro-matches-selector
IE10+, all modern browsers
Use matchesSelector v1 for IE8 and IE9 support.
matchesSelector is released under the MIT license