dom-matches

Check if a DOM element matches a given selector

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
dom-matches
1912.0.08 years ago9 years agoMinified + gzip package size for dom-matches in KB

Readme

dom-matches
Build Status
Check if a DOM element matches a given selector.

Installation

npm install dom-matches

API

matches(elem, selector)

  • elem: a DOM node.
  • selector: a CSS selector string.

var matches = require('dom-matches');
var elem = document.querySelector('.foo');

matches(elem, '.foo');
// => true

matches(elem, '.bar');
// => false

Browser support

  • Google Chrome
  • Firefox ESR+
  • Internet Explorer 10+
  • Safari 6+
  • Opera