HAST Selector Utilities

JSON →
library 6.0.4 ·javascript
verified May 27, 2026

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.

total hits 16
actors 8 distinct systems
last hit 2d ago Bingbot
MetaBot
4
GPTBot
2
Script
1
ClaudeBot
1
Search engines
2

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇳🇴 Norway · 🇩🇪 Germany · 🇫🇷 France