Socket
Socket
Sign inDemoInstall

matches-selector

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matches-selector

Check if a DOM element matches a given selector, with decent browser support and unit tests.


Version published
Weekly downloads
103K
decreased by-13.35%
Maintainers
1
Weekly downloads
 
Created

What is matches-selector?

The matches-selector npm package is a utility that allows you to check if a DOM element matches a given CSS selector. It provides a simple and consistent way to perform this check across different browsers.

What are matches-selector's main functionalities?

Check if an element matches a selector

This feature allows you to check if a specific DOM element matches a given CSS selector. The code sample demonstrates how to use the matches-selector package to check if an element with the ID 'myElement' matches the CSS class '.myClass'.

const matchesSelector = require('matches-selector');
const element = document.querySelector('#myElement');
const isMatch = matchesSelector(element, '.myClass');
console.log(isMatch); // true or false

Other packages similar to matches-selector

Keywords

FAQs

Package last updated on 23 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc