All Projects → necolas → dom-matches

necolas / dom-matches

Licence: MIT license
Check if a DOM element matches a given selector.

Programming Languages

javascript
184084 projects - #8 most used programming language

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].