Skip to content
Check if a DOM element matches a CSS selector
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
CHANGELOG.md
LICENSE
README.md
index.js
package.json
test.js

README.md

chi-matches

NPM

Build Status Dependency Status

Selenium Test Status

Check if a DOM element matches a CSS selector.

A cross-browser wrapper for the Element#matches function. It will choose the appropriate native method (including vendor prefixes) to use.

This module uses Node.js-style modules, for best results use browserify.

Example

var matches = require('chi-matches');

var div = document.createElement('div');
matches(div, 'div'); // true
matches(div, 'p'); // false

Reference

matches(el, selector)

Returns true if el matches the CSS selector specified by selector. Otherwise returns false.

Something went wrong with that request. Please try again.