HAST Selector Utilities
JSON →hast-util-select provides a suite of utilities for querying and matching nodes within a HAST (HTML Abstract Syntax Tree) structure using CSS selectors. It offers functions equivalent to DOM's `matches`, `querySelector`, and `querySelectorAll` for HTML trees. The current stable version is 6.0.4, with active maintenance and a regular release cadence, including recent major updates. A key differentiator is its specific application to HAST, which means it operates differently from DOM selectors in certain aspects, particularly regarding parent-sensitive selectors (e.g., `:first-child`, descendant selectors) due to HAST nodes not storing parent references. While powerful for targeted queries, it advises caution for high-frequency use, suggesting `unist-util-visit` for bulk modifications due to its tree-walking overhead.
Traffic · last 30 days ↑250% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇳🇴 Norway · 🇩🇪 Germany · 🇫🇷 France