Skip to main content

has_descendant_match

Function has_descendant_match 

Source
pub(crate) fn has_descendant_match(
    children: &[Node],
    list: &[(bool, SimpleSelector)],
) -> bool
Expand description

:has(sel1, sel2, ...) 判定用: children 以下にリスト中いずれかの単純セレクタへ 一致する要素が存在するかを探索する。タプルの bool が true(> sel 形式)の枝は children(直接子)のみを見て、それより深くは再帰しない。false(通常の :has(.foo))の 枝は任意の深さまで再帰する。子孫側の疑似クラス判定は sibling_index 等の文脈を持たない ため None/空リストで簡略化して渡す(:has(.foo) のようなタグ/クラス/id/属性ベースの 判定が主な実用対象で、:has(:first-child) 等の兄弟文脈依存の疑似クラスは子孫探索側では 正しく判定できない既知の制約)。