Milky2018/css/selector does not have a README file

    Attribute

    pub(all) struct Attribute {
    name : String
    value : String
    }

    Attribute value on an element

    AttributeMatch

    pub enum AttributeMatch {
    Exists
    Exact(String)
    Includes(String)
    DashMatch(String)
    Prefix(String)
    Suffix(String)
    Substring(String)
    }

    Attribute matching mode

    AttributeMatch::output

    fn AttributeMatch::output(self : AttributeMatch, logger : &Logger) -> Unit

    AttributeMatch::to_string

    fn AttributeMatch::to_string(self : AttributeMatch) -> String

    AttributeSelector

    pub struct AttributeSelector {
    name : String
    match_type : AttributeMatch
    case_insensitive : Bool
    any_namespace : Bool
    }

    Attribute selector

    AttributeSelector::output

    fn AttributeSelector::output(self : AttributeSelector, logger : &Logger) -> Unit

    AttributeSelector::to_string

    fn AttributeSelector::to_string(self : AttributeSelector) -> String

    Combinator

    pub enum Combinator {
    Descendant
    Child
    NextSibling
    SubsequentSibling
    }

    Combinator between compound selectors
    impl Show for Combinator

    Combinator::output

    fn Combinator::output(self : Combinator, logger : &Logger) -> Unit

    Combinator::to_string

    fn Combinator::to_string(self : Combinator) -> String

    ComplexSelector

    pub struct ComplexSelector {
    head : CompoundSelector
    tail : Array[ComplexSelectorStep]
    }

    Complex selector - compound selectors joined by combinators e.g., div > p.intro + span

    ComplexSelector::output

    fn ComplexSelector::output(self : ComplexSelector, logger : &Logger) -> Unit

    ComplexSelector::simple

    Create a complex selector from a single compound

    ComplexSelector::to_string

    fn ComplexSelector::to_string(self : ComplexSelector) -> String

    ComplexSelectorStep

    pub struct ComplexSelectorStep {
    combinator : Combinator
    selector : CompoundSelector
    }

    A step in a complex selector: combinator + compound selector

    CompoundSelector

    pub struct CompoundSelector {
    type_selector : SimpleSelector?
    subclasses : Array[SimpleSelector]
    any_ns_universal : Bool
    }

    Compound selector - a sequence of simple selectors without combinator e.g., div.foo#bar:hover

    CompoundSelector::from_class

    fn CompoundSelector::from_class(class_name : String) -> CompoundSelector

    Create a simple compound selector with just a class selector

    CompoundSelector::from_id

    fn CompoundSelector::from_id(id : String) -> CompoundSelector

    Create a simple compound selector with just an ID selector

    CompoundSelector::from_type

    fn CompoundSelector::from_type(tag_name : String) -> CompoundSelector

    Create a simple compound selector with just a type selector

    CompoundSelector::output

    fn CompoundSelector::output(self : CompoundSelector, logger : &Logger) -> Unit

    CompoundSelector::to_string

    fn CompoundSelector::to_string(self : CompoundSelector) -> String

    CompoundSelector::universal

    Create a simple compound selector with universal selector

    Element

    pub(all) struct Element {
    tag_name : String
    id : String?
    classes : Array[String]
    attributes : Array[Attribute]
    custom_states : Array[String]
    parent : Element?
    prev_sibling : Element?
    next_sibling : Element?
    children : Array[Element]
    sibling_index : Int
    sibling_count : Int
    }

    Element data for selector matching This is a concrete type that can be used with or without a real DOM

    Element::add_class

    fn Element::add_class(self : Element, class_name : String) -> Element

    Element::add_custom_state

    fn Element::add_custom_state(self : Element, state : String) -> Element

    Element::get_attribute

    fn Element::get_attribute(self : Element, name : String) -> String?

    Get attribute value by name

    Element::has_class

    fn Element::has_class(self : Element, class_name : String) -> Bool

    Check if element has a specific class

    Element::is_first_child

    fn Element::is_first_child(self : Element) -> Bool

    Check if element is first child

    Element::is_last_child

    fn Element::is_last_child(self : Element) -> Bool

    Check if element is last child

    Element::new

    fn Element::new(tag_name : String) -> Element

    Create a new element with minimal information

    Element::set_attribute

    fn Element::set_attribute(self : Element, name : String, value : String) -> Element

    Element::set_id

    fn Element::set_id(self : Element, id : String) -> Element

    Builder for creating elements with fluent API

    Element::set_parent

    fn Element::set_parent(self : Element, parent : Element) -> Element

    Element::set_sibling_info

    fn Element::set_sibling_info(self : Element, index : Int, count : Int) -> Element

    Element::with_classes

    fn Element::with_classes(tag_name : String, classes : Array[String]) -> Element

    Create an element with classes

    Element::with_id

    fn Element::with_id(tag_name : String, id : String) -> Element

    Create an element with id

    ForcedPseudoStates

    pub(all) struct ForcedPseudoStates {
    hover : Bool
    focus : Bool
    active : Bool
    focus_visible : Bool
    focus_within : Bool
    } derive(Eq,
    Debug
    )

    ForcedPseudoStates::equal

    ForcedPseudoStates::is_empty

    fn ForcedPseudoStates::is_empty(self : ForcedPseudoStates) -> Bool

    ForcedPseudoStates::none

    ForcedPseudoStates::not_equal

    ForcedPseudoStates::output

    fn ForcedPseudoStates::output(self : ForcedPseudoStates, logger : &Logger) -> Unit

    ForcedPseudoStates::to_string

    fn ForcedPseudoStates::to_string(self : ForcedPseudoStates) -> String

    NthExpr

    pub struct NthExpr {
    a : Int
    b : Int
    }

    Nth expression: An+B
    impl Show for NthExpr

    NthExpr::output

    fn NthExpr::output(self : NthExpr, logger : &Logger) -> Unit

    NthExpr::to_string

    fn NthExpr::to_string(self : NthExpr) -> String

    PseudoClass

    pub enum PseudoClass {
    FirstChild
    LastChild
    OnlyChild
    NthChild(NthExpr)
    NthLastChild(NthExpr)
    FirstOfType
    LastOfType
    OnlyOfType
    NthOfType(NthExpr)
    NthLastOfType(NthExpr)
    Root
    Empty
    Not(Array[ComplexSelector])
    Is(Array[ComplexSelector])
    Where(Array[ComplexSelector])
    Has(Array[RelativeSelector])
    State(String)
    Host
    HostFunc(CompoundSelector)
    HostContextFunc(CompoundSelector)
    Heading(Array[Int])
    Dir(String)
    Lang(Array[String])
    Hover
    Active
    Focus
    FocusVisible
    FocusWithin
    Link
    Visited
    AnyLink
    Enabled
    Disabled
    Checked
    Indeterminate
    Required
    Optional
    Valid
    Invalid
    ReadOnly
    ReadWrite
    }

    Pseudo-class selector
    impl Show for PseudoClass

    PseudoClass::output

    fn PseudoClass::output(self : PseudoClass, logger : &Logger) -> Unit

    PseudoClass::to_string

    fn PseudoClass::to_string(self : PseudoClass) -> String

    PseudoElement

    pub enum PseudoElement {
    Before
    After
    FirstLine
    FirstLetter
    Marker
    Placeholder
    Selection
    Backdrop
    FileSelectorButton
    PlaceholderShown
    TargetText
    SpellingError
    GrammarError
    Cue
    Part(Array[String])
    Slotted(Array[CompoundSelector])
    }

    Pseudo-element selector

    PseudoElement::output

    fn PseudoElement::output(self : PseudoElement, logger : &Logger) -> Unit

    PseudoElement::to_string

    fn PseudoElement::to_string(self : PseudoElement) -> String

    RelativeSelector

    pub struct RelativeSelector {
    combinator : Combinator?
    selector : ComplexSelector
    }

    Relative selector for :has()

    SelectorList

    pub struct SelectorList {
    selectors : Array[ComplexSelector]
    }

    Selector list - comma-separated selectors

    SelectorList::output

    fn SelectorList::output(self : SelectorList, logger : &Logger) -> Unit

    SelectorList::to_string

    fn SelectorList::to_string(self : SelectorList) -> String

    ShadowContext

    pub(all) struct ShadowContext {
    host : Element
    host_ancestors : Array[Element]
    assigned_slot : Element?
    }

    Shadow DOM scoping information for selector matching.

    host is the shadow host for the current styling scope. host_ancestors is the light-tree ancestor chain used by :host-context(). If it is empty, the matcher falls back to walking host.parent. assigned_slot is the slot assigned to the element currently being matched by ::slotted().

    ShadowContext::new

    ShadowContext::set_assigned_slot

    fn ShadowContext::set_assigned_slot(self : ShadowContext, assigned_slot : Element) -> ShadowContext

    ShadowContext::set_host_ancestors

    fn ShadowContext::set_host_ancestors(self : ShadowContext, host_ancestors : Array[Element]) -> ShadowContext

    SimpleSelector

    pub enum SimpleSelector {
    Type(String)
    Universal
    Id(String)
    Class(String)
    Attribute(AttributeSelector)
    PseudoClass(PseudoClass)
    PseudoElement(PseudoElement)
    }

    Simple selector - a single component

    SimpleSelector::output

    fn SimpleSelector::output(self : SimpleSelector, logger : &Logger) -> Unit

    SimpleSelector::to_string

    fn SimpleSelector::to_string(self : SimpleSelector) -> String

    Specificity

    pub(all) struct Specificity {
    a : Int
    b : Int
    c : Int
    } derive(Compare, Eq)

    Specificity as (a, b, c) tuple a: ID selectors count b: class selectors, attribute selectors, pseudo-classes count c: type selectors, pseudo-elements count
    impl Show for Specificity

    Specificity::add

    fn Specificity::add(self : Specificity, other : Specificity) -> Specificity

    Specificity::compare

    fn Specificity::compare(Specificity, Specificity) -> Int

    Specificity::compare_to

    fn Specificity::compare_to(self : Specificity, other : Specificity) -> Int

    Compare specificities for cascade ordering Returns positive if self > other, negative if self < other, 0 if equal

    Specificity::equal

    fn Specificity::equal(Specificity, Specificity) -> Bool

    Specificity::not_equal

    fn Specificity::not_equal(x : Specificity, y : Specificity) -> Bool

    Specificity::op_ge

    fn Specificity::op_ge(x : Specificity, y : Specificity) -> Bool

    Specificity::op_gt

    fn Specificity::op_gt(x : Specificity, y : Specificity) -> Bool

    Specificity::op_le

    fn Specificity::op_le(x : Specificity, y : Specificity) -> Bool

    Specificity::op_lt

    fn Specificity::op_lt(x : Specificity, y : Specificity) -> Bool

    Specificity::output

    fn Specificity::output(self : Specificity, logger : &Logger) -> Unit

    Specificity::to_string

    fn Specificity::to_string(self : Specificity) -> String

    Specificity::zero

    fn Specificity::zero() -> Specificity

    complex_specificity

    fn complex_specificity(sel : ComplexSelector) -> Specificity

    Calculate specificity of a complex selector

    matches_complex

    fn matches_complex(element : Element, selector : ComplexSelector) -> Bool

    Check if an element matches a complex selector

    matches_complex_with_forced_states

    fn matches_complex_with_forced_states(element : Element, selector : ComplexSelector, forced : ForcedPseudoStates) -> Bool

    Check if an element matches a complex selector with forced states. Forced states only apply to the subject element (the head/rightmost selector).

    matches_complex_with_shadow_context

    fn matches_complex_with_shadow_context(element : Element, selector : ComplexSelector, context : ShadowContext?) -> Bool

    matches_pseudo_class_with_forced_states

    fn matches_pseudo_class_with_forced_states(element : Element, pc : PseudoClass, forced : ForcedPseudoStates) -> Bool

    Check if an element matches a pseudo-class with forced states applied.

    matches_selector_list

    fn matches_selector_list(element : Element, list : SelectorList) -> Bool

    Check if an element matches any selector in a list

    matches_selector_list_with_shadow_context

    fn matches_selector_list_with_shadow_context(element : Element, list : SelectorList, context : ShadowContext?) -> Bool

    parse_selector_list_from_tokens

    fn parse_selector_list_from_tokens(tokens : Array[
    Token
    ], start : Int, end : Int) -> Array[ComplexSelector]

    Parse a selector-list from an existing token stream in-place (tokens[start..end]). This is the fast path used by parser/stylesheet: callers reuse tokens they have already lexed instead of stringifying + re-tokenizing the slice.

    Returns (text, selector) pairs because the stylesheet parser stores both the original source text and the parsed selector for every rule; we synthesize the text from the same slice.

    parse_selector_list_text

    fn parse_selector_list_text(css : String) -> SelectorList?

    Convenience function to parse a selector list from CSS text

    parse_selector_text

    fn parse_selector_text(css : String) -> ComplexSelector?

    Convenience function to parse a selector from CSS text