A CSS selector compiler/engine that turns CSS selectors into functions for testing and querying DOM elements. Current stable version is 2.x (v1.3.0-rc0 is a pre-release of a UMD build). It uses right-to-left execution for efficient O(n) performance, unlike left-to-right engines like Sizzle. Features full CSS3 selectors, partial jQuery extensions, and uses domhandler/domutils as default DOM adapter. Released regularly via npm; TypeScript types included since v1.3.0. Key differentiator: performance through right-to-left compilation and a function-stack approach.
npm install css-select-umdNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use css-select-umd to query DOM elements from parsed HTML using htmlparser2.
Use stable version 2.x instead or pin to exact pre-release version.
Import from 'css-select-umd' or from 'css-select' if not using UMD.
Upgrade to css-select v2+ for latest API and use 'css-select' package directly instead of UMD bundle if possible.
Wrap selector calls in try-catch or validate selectors before passing to CSSselect.
Use 'import CSSselect from 'css-select-umd'' or 'const CSSselect = require('css-select-umd').default'Install domhandler: npm install domhandler
Ensure you pass a valid DOM tree (e.g., from domhandler) and that elements have a 'type' property.