Check if a DOM element matches a given selector, with decent browser support and unit tests.

npm install matches-selector
2 downloads in the last day
13 downloads in the last week
88 downloads in the last month


Check if an element matches a given selector. For use with browserify.

Dependency Status NPM version

browser support


$ npm install matches-selector


var matches = require('matches-selector');
matches(el, 'ul li a');
// => true or false

Running Tests

Tests can be easilly run locally in the browser of your choice, and have passed if it ends with # ok. They are also run on testling-ci when pushed to the repository:

npm install
npm test

To re-run tests after making changes, just refresh your browser



npm loves you