Expand description
Minimal CSS-subset selector for streaming-parser emit modes.
§Supported syntax
| Syntax | Meaning |
|---|---|
tag | element name matches tag |
* | any element |
.class | class attribute contains the token (HTML semantics) |
#id | id attribute equals |
[attr] | element has the attribute |
[attr=value] | attribute equals (unquoted, "…", or '…') |
A B | B is a descendant of A |
A > B | B is a direct child of A |
Simple selectors combine: tag.class.other#id[attr][a=b]. Combinators
chain: feed > entry[type="article"].
§Intentionally unsupported
:pseudo-classeslike:nth-child— most need lookahead the streaming parser cannot provide.~and+sibling combinators — same reason.- Attribute operators other than
=: no~=,|=,^=,$=,*=. - Comma-separated multi-selectors (
a, b).
§Anchoring
Like real CSS, selectors are not anchored to the document root. item
matches an <item> element anywhere, including nested ones. Use a
path-based emit mode on the streaming parser when you need exact
root-anchored matching with guaranteed memory bounding.
Structs§
- Parse
Selector Error - Error parsing a selector string.
- Selector
- A parsed selector. Construct with
Selector::parse.