Struct selectors::context::MatchingContext
[−]
[src]
pub struct MatchingContext<'a, Impl> where
Impl: SelectorImpl, {
pub matching_mode: MatchingMode,
pub bloom_filter: Option<&'a BloomFilter>,
pub nth_index_cache: Option<&'a mut NthIndexCache>,
pub visited_handling: VisitedHandlingMode,
pub scope_element: Option<OpaqueElement>,
pub nesting_level: usize,
pub pseudo_element_matching_fn: Option<&'a Fn(&Impl::PseudoElement) -> bool>,
// some fields omitted
}
Data associated with the matching process for a element. This context is used across many selectors for an element, so it's not appropriate for transient data that applies to only a single selector.
Fields
matching_mode: MatchingMode
Input with the matching mode we should use when matching selectors.
bloom_filter: Option<&'a BloomFilter>
Input with the bloom filter used to fast-reject selectors.
nth_index_cache: Option<&'a mut NthIndexCache>
An optional cache to speed up nth-index-like selectors.
visited_handling: VisitedHandlingMode
Input that controls how matching for links is handled.
scope_element: Option<OpaqueElement>
The element which is going to match :scope pseudo-class. It can be either one :scope element, or the scoping element.
Note that, although in theory there can be multiple :scope elements, in current specs, at most one is specified, and when there is one, scoping element is not relevant anymore, so we use a single field for them.
When this is None, :scope will match the root element.
nesting_level: usize
The current nesting level of selectors that we're matching.
FIXME(emilio): Move this somewhere else and make MatchingContext immutable again.
pseudo_element_matching_fn: Option<&'a Fn(&Impl::PseudoElement) -> bool>
An optional hook function for checking whether a pseudo-element should match when matching_mode is ForStatelessPseudoElement.
Methods
impl<'a, Impl> MatchingContext<'a, Impl> where
Impl: SelectorImpl,
[src]
Impl: SelectorImpl,
pub fn new(
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
quirks_mode: QuirksMode
) -> Self
[src]
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
quirks_mode: QuirksMode
) -> Self
Constructs a new MatchingContext
.
pub fn new_for_visited(
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
visited_handling: VisitedHandlingMode,
quirks_mode: QuirksMode
) -> Self
[src]
matching_mode: MatchingMode,
bloom_filter: Option<&'a BloomFilter>,
nth_index_cache: Option<&'a mut NthIndexCache>,
visited_handling: VisitedHandlingMode,
quirks_mode: QuirksMode
) -> Self
Constructs a new MatchingContext
for use in visited matching.
pub fn quirks_mode(&self) -> QuirksMode
[src]
The quirks mode of the document.
pub fn classes_and_ids_case_sensitivity(&self) -> CaseSensitivity
[src]
The case-sensitivity for class and ID selectors