pub struct CompoundSelector {
pub parts: Vec<SelectorPart>,
pub specificity: Specificity,
}Expand description
A compound selector representing a sequence of simple selectors without combinators.
Fields§
§parts: Vec<SelectorPart>§specificity: SpecificityImplementations§
Source§impl CompoundSelector
impl CompoundSelector
Sourcepub fn parse(input: &str) -> Result<Self, String>
pub fn parse(input: &str) -> Result<Self, String>
Parses a single compound selector (e.g. button.btn-primary:hover[disabled]).
Sourcepub fn matches<C: AsRef<str>>(
&self,
tag: &str,
classes: &[C],
id: Option<&str>,
attributes: &[(String, String)],
state: &PseudoState,
) -> bool
pub fn matches<C: AsRef<str>>( &self, tag: &str, classes: &[C], id: Option<&str>, attributes: &[(String, String)], state: &PseudoState, ) -> bool
Evaluates whether this compound selector matches an element’s attributes and pseudo-state.
Sourcepub fn matches_with_context<C: AsRef<str>>(
&self,
tag: &str,
classes: &[C],
id: Option<&str>,
attributes: &[(String, String)],
state: &PseudoState,
preceding_siblings: &[ElementRef<'_>],
is_last_child: Option<bool>,
is_last_of_type: Option<bool>,
children: &[ElementRef<'_>],
) -> bool
pub fn matches_with_context<C: AsRef<str>>( &self, tag: &str, classes: &[C], id: Option<&str>, attributes: &[(String, String)], state: &PseudoState, preceding_siblings: &[ElementRef<'_>], is_last_child: Option<bool>, is_last_of_type: Option<bool>, children: &[ElementRef<'_>], ) -> bool
Evaluates whether this compound selector matches an element considering sibling, positional, and children context.
Sourcepub fn has_interactive_pseudo(&self) -> bool
pub fn has_interactive_pseudo(&self) -> bool
Returns true if this compound selector references :hover, :active, or :focus.
Trait Implementations§
Source§impl Clone for CompoundSelector
impl Clone for CompoundSelector
Source§impl Debug for CompoundSelector
impl Debug for CompoundSelector
Source§impl Default for CompoundSelector
impl Default for CompoundSelector
impl Eq for CompoundSelector
Source§impl PartialEq for CompoundSelector
impl PartialEq for CompoundSelector
impl StructuralPartialEq for CompoundSelector
Auto Trait Implementations§
impl Forget for CompoundSelector
impl Freeze for CompoundSelector
impl Move for CompoundSelector
impl RefUnwindSafe for CompoundSelector
impl Send for CompoundSelector
impl Sync for CompoundSelector
impl Unpin for CompoundSelector
impl UnsafeUnpin for CompoundSelector
impl UnwindSafe for CompoundSelector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more