pub struct Selector { /* private fields */ }
Expand description
Wrapper around CSS selectors.
Represents a “selector group”, i.e. a comma-separated list of selectors.
Implementations§
Source§impl Selector
impl Selector
Sourcepub fn parse(selectors: &str) -> Result<Self, SelectorErrorKind<'_>>
pub fn parse(selectors: &str) -> Result<Self, SelectorErrorKind<'_>>
Parses a CSS selector group.
Sourcepub fn matches(&self, element: &ElementRef<'_>) -> bool
pub fn matches(&self, element: &ElementRef<'_>) -> bool
Returns true if the element matches this selector.
Sourcepub fn matches_with_scope(
&self,
element: &ElementRef<'_>,
scope: Option<ElementRef<'_>>,
) -> bool
pub fn matches_with_scope( &self, element: &ElementRef<'_>, scope: Option<ElementRef<'_>>, ) -> bool
Returns true if the element matches this selector.
The optional scope
argument is used to specify which element has :scope
pseudo-class.
When it is None
, :scope
will match the root element.
Trait Implementations§
impl Eq for Selector
impl StructuralPartialEq for Selector
Auto Trait Implementations§
impl Freeze for Selector
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnwindSafe for Selector
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