Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nwmatcher

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nwmatcher

A CSS3-compliant JavaScript selector engine.

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1M
increased by66.86%
Maintainers
2
Weekly downloads
 
Created

What is nwmatcher?

The nwmatcher npm package is a fast CSS selector engine and matcher, primarily used for matching DOM elements against CSS selectors. It is useful for tasks such as querying and filtering elements in a DOM-like structure.

What are nwmatcher's main functionalities?

Matching Elements

This feature allows you to check if a given DOM element matches a specific CSS selector.

const NWMatcher = require('nwmatcher');
const matcher = NWMatcher({ document });
const element = document.getElementById('example');
const isMatch = matcher.match(element, '.example-class');
console.log(isMatch); // true or false

Querying Elements

This feature allows you to query and retrieve all DOM elements that match a specific CSS selector.

const NWMatcher = require('nwmatcher');
const matcher = NWMatcher({ document });
const elements = matcher.select('.example-class');
console.log(elements); // Array of elements matching the selector

Custom Selectors

This feature allows you to register and use custom selectors for more advanced querying.

const NWMatcher = require('nwmatcher');
const matcher = NWMatcher({ document });
matcher.registerSelector('custom', function(element) {
  return element.hasAttribute('data-custom');
});
const elements = matcher.select(':custom');
console.log(elements); // Array of elements with the 'data-custom' attribute

Other packages similar to nwmatcher

Keywords

FAQs

Package last updated on 11 Feb 2013

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