Expand description
CSS selector parser. CSS selector parser.
Parses a CSS selector string into an ast::SelectorList using a
hand-rolled recursive-descent parser. Supports:
- Type selectors:
div,p,span - Class selectors:
.class - ID selectors:
#id - Universal selector:
* - Attribute selectors:
[attr],[attr=val],[attr~=val],[attr^=val],[attr$=val],[attr*=val] - Pseudo-classes:
:first-child,:last-child,:nth-child(an+b),:not(sel) - Compound selectors:
div.class#id[attr] - Combinators:
A B(descendant),A > B(child),A + B(adjacent),A ~ B(general sibling) - Comma-separated selector lists:
div, span
Functionsยง
- parse_
selector - Parse a CSS selector string into a
SelectorList. - parse_
single_ selector - Parse a single CSS selector (no commas).