Enum selectors::parser::Component
[−]
[src]
pub enum Component<Impl: SelectorImpl> {
Combinator(Combinator),
ExplicitAnyNamespace,
ExplicitNoNamespace,
DefaultNamespace(Impl::NamespaceUrl),
Namespace(Impl::NamespacePrefix, Impl::NamespaceUrl),
ExplicitUniversalType,
LocalName(LocalName<Impl>),
ID(Impl::Identifier),
Class(Impl::ClassName),
AttributeInNoNamespaceExists {
local_name: Impl::LocalName,
local_name_lower: Impl::LocalName,
},
AttributeInNoNamespace {
local_name: Impl::LocalName,
local_name_lower: Impl::LocalName,
operator: AttrSelectorOperator,
value: Impl::AttrValue,
case_sensitivity: ParsedCaseSensitivity,
never_matches: bool,
},
AttributeOther(Box<AttrSelectorWithNamespace<Impl>>),
Negation(Box<[Component<Impl>]>),
FirstChild,
LastChild,
OnlyChild,
Root,
Empty,
Scope,
NthChild(i32, i32),
NthLastChild(i32, i32),
NthOfType(i32, i32),
NthLastOfType(i32, i32),
FirstOfType,
LastOfType,
OnlyOfType,
NonTSPseudoClass(Impl::NonTSPseudoClass),
Slotted(Selector<Impl>),
PseudoElement(Impl::PseudoElement),
}A CSS simple selector or combinator. We store both in the same enum for optimal packing and cache performance, see [1].
Variants
Combinator(Combinator)ExplicitAnyNamespaceExplicitNoNamespaceDefaultNamespace(Impl::NamespaceUrl)Namespace(Impl::NamespacePrefix, Impl::NamespaceUrl)ExplicitUniversalTypeLocalName(LocalName<Impl>)ID(Impl::Identifier)Class(Impl::ClassName)AttributeInNoNamespaceExistsFields of AttributeInNoNamespaceExists
local_name: Impl::LocalName | |
local_name_lower: Impl::LocalName |
AttributeInNoNamespaceFields of AttributeInNoNamespace
local_name: Impl::LocalName | |
local_name_lower: Impl::LocalName | |
operator: AttrSelectorOperator | |
value: Impl::AttrValue | |
case_sensitivity: ParsedCaseSensitivity | |
never_matches: bool |
AttributeOther(Box<AttrSelectorWithNamespace<Impl>>)Negation(Box<[Component<Impl>]>)Pseudo-classes
CSS3 Negation only takes a simple simple selector, but we still need to treat it as a compound selector because it might be a type selector which we represent as a namespace and a localname.
Note: if/when we upgrade this to CSS4, which supports combinators, we need to think about how this should interact with visit_complex_selector, and what the consumers of those APIs should do about the presence of combinators in negation.
FirstChildLastChildOnlyChildRootEmptyScopeNthChild(i32, i32)NthLastChild(i32, i32)NthOfType(i32, i32)NthLastOfType(i32, i32)FirstOfTypeLastOfTypeOnlyOfTypeNonTSPseudoClass(Impl::NonTSPseudoClass)Slotted(Selector<Impl>)The ::slotted() pseudo-element (which isn't actually a pseudo-element, and probably should be a pseudo-class):
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.
PseudoElement(Impl::PseudoElement)
Methods
impl<Impl: SelectorImpl> Component<Impl>[src]
pub fn is_combinator(&self) -> bool[src]
Returns true if this is a combinator.
pub fn as_combinator(&self) -> Option<Combinator>[src]
Returns the value as a combinator if applicable, None otherwise.
Trait Implementations
impl<Impl: SelectorImpl> SelectorMethods for Component<Impl>[src]
type Impl = Impl
fn visit<V>(&self, visitor: &mut V) -> bool where
V: SelectorVisitor<Impl = Impl>, [src]
V: SelectorVisitor<Impl = Impl>,
impl<Impl: Clone + SelectorImpl> Clone for Component<Impl> where
Impl::NamespaceUrl: Clone,
Impl::NamespacePrefix: Clone,
Impl::NamespaceUrl: Clone,
Impl::Identifier: Clone,
Impl::ClassName: Clone,
Impl::LocalName: Clone,
Impl::LocalName: Clone,
Impl::LocalName: Clone,
Impl::LocalName: Clone,
Impl::AttrValue: Clone,
Impl::NonTSPseudoClass: Clone,
Impl::PseudoElement: Clone, [src]
Impl::NamespaceUrl: Clone,
Impl::NamespacePrefix: Clone,
Impl::NamespaceUrl: Clone,
Impl::Identifier: Clone,
Impl::ClassName: Clone,
Impl::LocalName: Clone,
Impl::LocalName: Clone,
Impl::LocalName: Clone,
Impl::LocalName: Clone,
Impl::AttrValue: Clone,
Impl::NonTSPseudoClass: Clone,
Impl::PseudoElement: Clone,
fn clone(&self) -> Component<Impl>[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl<Impl: Eq + SelectorImpl> Eq for Component<Impl> where
Impl::NamespaceUrl: Eq,
Impl::NamespacePrefix: Eq,
Impl::NamespaceUrl: Eq,
Impl::Identifier: Eq,
Impl::ClassName: Eq,
Impl::LocalName: Eq,
Impl::LocalName: Eq,
Impl::LocalName: Eq,
Impl::LocalName: Eq,
Impl::AttrValue: Eq,
Impl::NonTSPseudoClass: Eq,
Impl::PseudoElement: Eq, [src]
Impl::NamespaceUrl: Eq,
Impl::NamespacePrefix: Eq,
Impl::NamespaceUrl: Eq,
Impl::Identifier: Eq,
Impl::ClassName: Eq,
Impl::LocalName: Eq,
Impl::LocalName: Eq,
Impl::LocalName: Eq,
Impl::LocalName: Eq,
Impl::AttrValue: Eq,
Impl::NonTSPseudoClass: Eq,
Impl::PseudoElement: Eq,
impl<Impl: PartialEq + SelectorImpl> PartialEq for Component<Impl> where
Impl::NamespaceUrl: PartialEq,
Impl::NamespacePrefix: PartialEq,
Impl::NamespaceUrl: PartialEq,
Impl::Identifier: PartialEq,
Impl::ClassName: PartialEq,
Impl::LocalName: PartialEq,
Impl::LocalName: PartialEq,
Impl::LocalName: PartialEq,
Impl::LocalName: PartialEq,
Impl::AttrValue: PartialEq,
Impl::NonTSPseudoClass: PartialEq,
Impl::PseudoElement: PartialEq, [src]
Impl::NamespaceUrl: PartialEq,
Impl::NamespacePrefix: PartialEq,
Impl::NamespaceUrl: PartialEq,
Impl::Identifier: PartialEq,
Impl::ClassName: PartialEq,
Impl::LocalName: PartialEq,
Impl::LocalName: PartialEq,
Impl::LocalName: PartialEq,
Impl::LocalName: PartialEq,
Impl::AttrValue: PartialEq,
Impl::NonTSPseudoClass: PartialEq,
Impl::PseudoElement: PartialEq,
fn eq(&self, __arg_0: &Component<Impl>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Component<Impl>) -> bool[src]
This method tests for !=.
impl<Impl: SelectorImpl> Debug for Component<Impl>[src]
fn fmt(&self, f: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more