Skip to main content

selector_matches

Function selector_matches 

Source
pub fn selector_matches(
    sel: &SelectorBuf,
    subject: &AncestorInfo,
    ancestors: &[AncestorInfo],
) -> bool
Expand description

Test whether sel matches subject, consulting ancestors (root-first, the same order RestyleWalk::new takes) for descendant / child combinators. Wraps the cascade matcher ([match_selector]) so query() and traversal share the exact match semantics of the live cascade.

Sibling combinators (+, ~) walk subject.siblings and each ancestor’s; without them a selector with a sibling step never matches. :empty reads subject.has_element_children and subject.text.