dom-matches
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/dom-matches package

2.0.0 • Public • Published

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

/dom-matches/

    Package Sidebar

    Install

    npm i dom-matches

    Weekly Downloads

    99,581

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • necolas