Type Alias lightningcss::selector::Component
source · pub type Component<'i> = Component<'i, Selectors>;
Expand description
An individual component within a selector.
Aliased Type§
enum Component<'i> {
Show 28 variants
Combinator(Combinator),
ExplicitAnyNamespace,
ExplicitNoNamespace,
DefaultNamespace(CowArcStr<'i>),
Namespace(Ident<'i>, CowArcStr<'i>),
ExplicitUniversalType,
LocalName(LocalName<'i, Selectors>),
ID(Ident<'i>),
Class(Ident<'i>),
AttributeInNoNamespaceExists {
local_name: Ident<'i>,
local_name_lower: Ident<'i>,
},
AttributeInNoNamespace {
local_name: Ident<'i>,
operator: AttrSelectorOperator,
value: CSSString<'i>,
case_sensitivity: ParsedCaseSensitivity,
never_matches: bool,
},
AttributeOther(Box<AttrSelectorWithOptionalNamespace<'i, Selectors>>),
Negation(Box<[Selector<'i, Selectors>]>),
Root,
Empty,
Scope,
Nth(NthSelectorData),
NthOf(NthOfSelectorData<'i, Selectors>),
NonTSPseudoClass(PseudoClass<'i>),
Slotted(Selector<'i, Selectors>),
Part(Box<[Ident<'i>]>),
Host(Option<Selector<'i, Selectors>>),
Where(Box<[Selector<'i, Selectors>]>),
Is(Box<[Selector<'i, Selectors>]>),
Any(VendorPrefix, Box<[Selector<'i, Selectors>]>),
Has(Box<[Selector<'i, Selectors>]>),
PseudoElement(PseudoElement<'i>),
Nesting,
}
Variants§
Combinator(Combinator)
ExplicitAnyNamespace
ExplicitNoNamespace
DefaultNamespace(CowArcStr<'i>)
Namespace(Ident<'i>, CowArcStr<'i>)
ExplicitUniversalType
LocalName(LocalName<'i, Selectors>)
ID(Ident<'i>)
Class(Ident<'i>)
AttributeInNoNamespaceExists
AttributeInNoNamespace
AttributeOther(Box<AttrSelectorWithOptionalNamespace<'i, Selectors>>)
Negation(Box<[Selector<'i, Selectors>]>)
Pseudo-classes
Root
Empty
Scope
Nth(NthSelectorData)
NthOf(NthOfSelectorData<'i, Selectors>)
NonTSPseudoClass(PseudoClass<'i>)
Slotted(Selector<'i, Selectors>)
The ::slotted() pseudo-element:
https://drafts.csswg.org/css-scoping/#slotted-pseudo
The selector here is a compound selector, that is, no combinators.
NOTE(emilio): This should support a list of selectors, but as of this writing no other browser does, and that allows them to put ::slotted() in the rule hash, so we do that too.
See https://github.com/w3c/csswg-drafts/issues/2158
Part(Box<[Ident<'i>]>)
The ::part
pseudo-element.
https://drafts.csswg.org/css-shadow-parts/#part
Host(Option<Selector<'i, Selectors>>)
The :host
pseudo-class:
https://drafts.csswg.org/css-scoping/#host-selector
NOTE(emilio): This should support a list of selectors, but as of this writing no other browser does, and that allows them to put :host() in the rule hash, so we do that too.
See https://github.com/w3c/csswg-drafts/issues/2158
Where(Box<[Selector<'i, Selectors>]>)
The :where
pseudo-class.
https://drafts.csswg.org/selectors/#zero-matches
The inner argument is conceptually a SelectorList, but we move the selectors to the heap to keep Component small.
Is(Box<[Selector<'i, Selectors>]>)
The :is
pseudo-class.
https://drafts.csswg.org/selectors/#matches-pseudo
Same comment as above re. the argument.
Any(VendorPrefix, Box<[Selector<'i, Selectors>]>)
Has(Box<[Selector<'i, Selectors>]>)
The :has
pseudo-class.
https://www.w3.org/TR/selectors/#relational
PseudoElement(PseudoElement<'i>)
An implementation-dependent pseudo-element selector.
Nesting
A nesting selector:
https://drafts.csswg.org/css-nesting-1/#nest-selector
NOTE: This is a lightningcss addition.