Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

desandro/matches-selector

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

DEPRECATION NOTICE

As of December 2020, all major browsers natively support .matches(). The last hold-out was IE11.

This repo is now in archive mode. Use matches() for any future development.

matchesSelector helper

matches/matchesSelector is pretty hot πŸ”₯, but has vendor-prefix baggage πŸ‘œ πŸ‘. This helper function takes care of that, without polyfilling or augmenting Element.prototype.

matchesSelector( elem, selector );
// for example
matchesSelector( myElem, 'div.my-hawt-selector' );

Install

Download matches-selector.js

Install with Bower: bower install matches-selector

Install with npm: npm install desandro-matches-selector

Browser support

IE10+, all modern browsers

Use matchesSelector v1 for IE8 and IE9 support.

MIT license

matchesSelector is released under the MIT license