Skip to main content

Module dom_selector

Module dom_selector 

Source
Expand description

W3C Selectors Level 3 / Level 4 準拠の DOM セレクタパーサ。

matches(), closest(), querySelector(), querySelectorAll() で共有される 純粋なセレクタ字句解析・構文木構築ロジックを提供する。

Structs§

AttrSel
CompoundSel
NthFormula
SelStep

Enums§

AttrOp
Combinator
PosPseudo

Functions§

build_steps
トークン列から SelStep 列を組み立てる。
nth_formula_matches
position(1始まり)が an+b 式(n は 0,1,2,…)のいずれかの n で表せるか判定する。
parse_attr_sel
[attr...] 1件を解析する。
parse_compound
単一コンパウンドセレクタ(div.active#foo[data-x=y]:not(...))を解析する。
parse_nth_formula
:nth-child() 引数(odd/even/N/aN+b/aN-b/-aN+b)を解析する。
split_top_level_commas
トップレベルカンマで区切る。
tokenize_selector_group
1グループ分のセレクタ文字列をトークン分割する。