[−][src]Enum selectors::parser::Component
A CSS simple selector or combinator. We store both in the same enum for optimal packing and cache performance, see [1].
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1357973
Variants
Combinator(Combinator)
DefaultNamespace(Impl::NamespaceUrl)
Namespace(Impl::NamespacePrefix, Impl::NamespaceUrl)
LocalName(LocalName<Impl>)
ID(Impl::Identifier)
Class(Impl::ClassName)
Fields of AttributeInNoNamespace
local_name: Impl::LocalName
operator: AttrSelectorOperator
value: Impl::AttrValue
case_sensitivity: ParsedCaseSensitivity
never_matches: bool
AttributeOther(Box<AttrSelectorWithOptionalNamespace<Impl>>)
Negation(ThinBoxedSlice<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.
NonTSPseudoClass(Impl::NonTSPseudoClass)
Slotted(Selector<Impl>)
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
The ::part
pseudo-element.
https://drafts.csswg.org/css-shadow-parts/#part
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
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: 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::AttrValue: Clone,
Impl::NonTSPseudoClass: Clone,
Impl::PartName: 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::AttrValue: Clone,
Impl::NonTSPseudoClass: Clone,
Impl::PartName: Clone,
Impl::PseudoElement: Clone,
impl<Impl: SelectorImpl> Debug for Component<Impl>
[src]
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::AttrValue: Eq,
Impl::NonTSPseudoClass: Eq,
Impl::PartName: 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::AttrValue: Eq,
Impl::NonTSPseudoClass: Eq,
Impl::PartName: Eq,
Impl::PseudoElement: Eq,
impl<Impl: PartialEq + SelectorImpl> PartialEq<Component<Impl>> 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::AttrValue: PartialEq,
Impl::NonTSPseudoClass: PartialEq,
Impl::PartName: 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::AttrValue: PartialEq,
Impl::NonTSPseudoClass: PartialEq,
Impl::PartName: PartialEq,
Impl::PseudoElement: PartialEq,
fn eq(&self, other: &Component<Impl>) -> bool
[src]
fn ne(&self, other: &Component<Impl>) -> bool
[src]
impl<Impl: SelectorImpl> StructuralEq for Component<Impl>
[src]
impl<Impl: SelectorImpl> StructuralPartialEq for Component<Impl>
[src]
impl<Impl: SelectorImpl> ToCss for Component<Impl>
[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write,
[src]
W: Write,
fn to_css_string(&self) -> String
[src]
impl<Impl: SelectorImpl> Visit for Component<Impl> where
Impl::NonTSPseudoClass: Visit<Impl = Impl>,
[src]
Impl::NonTSPseudoClass: Visit<Impl = Impl>,
Auto Trait Implementations
impl<Impl> RefUnwindSafe for Component<Impl> where
<Impl as SelectorImpl>::AttrValue: RefUnwindSafe,
<Impl as SelectorImpl>::ClassName: RefUnwindSafe,
<Impl as SelectorImpl>::Identifier: RefUnwindSafe,
<Impl as SelectorImpl>::LocalName: RefUnwindSafe,
<Impl as SelectorImpl>::NamespacePrefix: RefUnwindSafe,
<Impl as SelectorImpl>::NamespaceUrl: RefUnwindSafe,
<Impl as SelectorImpl>::NonTSPseudoClass: RefUnwindSafe,
<Impl as SelectorImpl>::PartName: RefUnwindSafe,
<Impl as SelectorImpl>::PseudoElement: RefUnwindSafe,
<Impl as SelectorImpl>::AttrValue: RefUnwindSafe,
<Impl as SelectorImpl>::ClassName: RefUnwindSafe,
<Impl as SelectorImpl>::Identifier: RefUnwindSafe,
<Impl as SelectorImpl>::LocalName: RefUnwindSafe,
<Impl as SelectorImpl>::NamespacePrefix: RefUnwindSafe,
<Impl as SelectorImpl>::NamespaceUrl: RefUnwindSafe,
<Impl as SelectorImpl>::NonTSPseudoClass: RefUnwindSafe,
<Impl as SelectorImpl>::PartName: RefUnwindSafe,
<Impl as SelectorImpl>::PseudoElement: RefUnwindSafe,
impl<Impl> Send for Component<Impl> where
<Impl as SelectorImpl>::AttrValue: Send + Sync,
<Impl as SelectorImpl>::ClassName: Send + Sync,
<Impl as SelectorImpl>::Identifier: Send + Sync,
<Impl as SelectorImpl>::LocalName: Send + Sync,
<Impl as SelectorImpl>::NamespacePrefix: Send + Sync,
<Impl as SelectorImpl>::NamespaceUrl: Send + Sync,
<Impl as SelectorImpl>::NonTSPseudoClass: Send + Sync,
<Impl as SelectorImpl>::PartName: Send + Sync,
<Impl as SelectorImpl>::PseudoElement: Send + Sync,
<Impl as SelectorImpl>::AttrValue: Send + Sync,
<Impl as SelectorImpl>::ClassName: Send + Sync,
<Impl as SelectorImpl>::Identifier: Send + Sync,
<Impl as SelectorImpl>::LocalName: Send + Sync,
<Impl as SelectorImpl>::NamespacePrefix: Send + Sync,
<Impl as SelectorImpl>::NamespaceUrl: Send + Sync,
<Impl as SelectorImpl>::NonTSPseudoClass: Send + Sync,
<Impl as SelectorImpl>::PartName: Send + Sync,
<Impl as SelectorImpl>::PseudoElement: Send + Sync,
impl<Impl> Sync for Component<Impl> where
<Impl as SelectorImpl>::AttrValue: Send + Sync,
<Impl as SelectorImpl>::ClassName: Send + Sync,
<Impl as SelectorImpl>::Identifier: Send + Sync,
<Impl as SelectorImpl>::LocalName: Send + Sync,
<Impl as SelectorImpl>::NamespacePrefix: Send + Sync,
<Impl as SelectorImpl>::NamespaceUrl: Send + Sync,
<Impl as SelectorImpl>::NonTSPseudoClass: Send + Sync,
<Impl as SelectorImpl>::PartName: Send + Sync,
<Impl as SelectorImpl>::PseudoElement: Send + Sync,
<Impl as SelectorImpl>::AttrValue: Send + Sync,
<Impl as SelectorImpl>::ClassName: Send + Sync,
<Impl as SelectorImpl>::Identifier: Send + Sync,
<Impl as SelectorImpl>::LocalName: Send + Sync,
<Impl as SelectorImpl>::NamespacePrefix: Send + Sync,
<Impl as SelectorImpl>::NamespaceUrl: Send + Sync,
<Impl as SelectorImpl>::NonTSPseudoClass: Send + Sync,
<Impl as SelectorImpl>::PartName: Send + Sync,
<Impl as SelectorImpl>::PseudoElement: Send + Sync,
impl<Impl> Unpin for Component<Impl> where
<Impl as SelectorImpl>::AttrValue: Unpin,
<Impl as SelectorImpl>::ClassName: Unpin,
<Impl as SelectorImpl>::Identifier: Unpin,
<Impl as SelectorImpl>::LocalName: Unpin,
<Impl as SelectorImpl>::NamespacePrefix: Unpin,
<Impl as SelectorImpl>::NamespaceUrl: Unpin,
<Impl as SelectorImpl>::NonTSPseudoClass: Unpin,
<Impl as SelectorImpl>::PseudoElement: Unpin,
<Impl as SelectorImpl>::AttrValue: Unpin,
<Impl as SelectorImpl>::ClassName: Unpin,
<Impl as SelectorImpl>::Identifier: Unpin,
<Impl as SelectorImpl>::LocalName: Unpin,
<Impl as SelectorImpl>::NamespacePrefix: Unpin,
<Impl as SelectorImpl>::NamespaceUrl: Unpin,
<Impl as SelectorImpl>::NonTSPseudoClass: Unpin,
<Impl as SelectorImpl>::PseudoElement: Unpin,
impl<Impl> UnwindSafe for Component<Impl> where
<Impl as SelectorImpl>::AttrValue: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::ClassName: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::Identifier: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::LocalName: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::NamespacePrefix: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::NamespaceUrl: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::NonTSPseudoClass: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::PartName: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::PseudoElement: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::AttrValue: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::ClassName: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::Identifier: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::LocalName: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::NamespacePrefix: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::NamespaceUrl: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::NonTSPseudoClass: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::PartName: RefUnwindSafe + UnwindSafe,
<Impl as SelectorImpl>::PseudoElement: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,