pub struct SelectorList(/* private fields */);Expand description
A comma-separated list of selectors; an element matches if any does.
Implementations§
Source§impl SelectorList
impl SelectorList
pub fn parse(selector: &str) -> Result<SelectorList, SelectorError>
Sourcepub fn parse_with(
selector: &str,
opts: &ParseOptions<'_>,
) -> Result<SelectorList, SelectorError>
pub fn parse_with( selector: &str, opts: &ParseOptions<'_>, ) -> Result<SelectorList, SelectorError>
SelectorList::parse with namespace prefixes declared, as
@namespace rules would.
Sourcepub fn matches(&self, doc: &Document, el: u32, scope: Option<u32>) -> bool
pub fn matches(&self, doc: &Document, el: u32, scope: Option<u32>) -> bool
Whether el matches, with scope as :scope (the root element
when None).
Sourcepub fn matches_with(
&self,
doc: &Document,
el: u32,
scope: Option<u32>,
options: &MatchOptions<'_>,
) -> bool
pub fn matches_with( &self, doc: &Document, el: u32, scope: Option<u32>, options: &MatchOptions<'_>, ) -> bool
SelectorList::matches with what the document alone can’t say,
such as its URL.
Sourcepub fn select_with(
&self,
doc: &Document,
scope: u32,
options: &MatchOptions<'_>,
) -> Vec<u32>
pub fn select_with( &self, doc: &Document, scope: u32, options: &MatchOptions<'_>, ) -> Vec<u32>
SelectorList::select with what the document alone can’t say,
such as its URL.
Sourcepub fn try_select_with(
&self,
doc: &Document,
scope: u32,
options: &MatchOptions<'_>,
) -> Result<Vec<u32>, MatchTimeout>
pub fn try_select_with( &self, doc: &Document, scope: u32, options: &MatchOptions<'_>, ) -> Result<Vec<u32>, MatchTimeout>
SelectorList::select_with within MatchOptions::budget: an
error once it has run out, rather than the matches found so far.
Sourcepub fn try_matches_with(
&self,
doc: &Document,
el: u32,
scope: Option<u32>,
options: &MatchOptions<'_>,
) -> Result<bool, MatchTimeout>
pub fn try_matches_with( &self, doc: &Document, el: u32, scope: Option<u32>, options: &MatchOptions<'_>, ) -> Result<bool, MatchTimeout>
Sourcepub fn select(&self, doc: &Document, scope: u32) -> Vec<u32>
pub fn select(&self, doc: &Document, scope: u32) -> Vec<u32>
The elements under scope that match, in document order. As in a
browser, combinators look past scope: article .price run on an
article matches the prices inside it.
Sourcepub fn select_iter<'a>(&'a self, doc: &'a Document, scope: u32) -> Select<'a> ⓘ
pub fn select_iter<'a>(&'a self, doc: &'a Document, scope: u32) -> Select<'a> ⓘ
The matches SelectorList::select gives, found one at a time as
the iterator is read, so stopping early walks only that far.
Sourcepub fn select_first(&self, doc: &Document, scope: u32) -> Option<u32>
pub fn select_first(&self, doc: &Document, scope: u32) -> Option<u32>
The first match in document order, without looking further.
Sourcepub fn specificity(&self) -> (u32, u32, u32)
pub fn specificity(&self) -> (u32, u32, u32)
Selectors 4’s specificity, (IDs, classes, types), of the most
specific selector in the list, which is how :is() counts one.
:is(), :not() and :has() count as their most specific
argument, :nth-child(An+B of S) as a class plus S, and :where()
as nothing. (|x, which matches nothing, counts a class too much.)
Trait Implementations§
Source§impl Clone for SelectorList
impl Clone for SelectorList
Source§fn clone(&self) -> SelectorList
fn clone(&self) -> SelectorList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more