Interface SelectorMatcher
- All Known Implementing Classes:
AbstractSelectorMatcher
,BaseSelectorMatcher
,DOMSelectorMatcher
The classes implementing this interface contain the logic for elements to match selectors.
Early versions of this library were designed to provide computed styles for both DOM and non-DOM implementations. The idea is that if an object implementing a SelectorMatcher can be built, the infrastructure to compute styles could be directly used. With today's library, providing computed styles for a DOM-like document that does not implement DOM would not be that straightforward, but should still be possible.
This interface is a remnant of the early design where the SelectorMatcher was the pivot
for all the computed style infrastructure, providing universal support for any document
backend; it also packs two matches
methods inside it. Modern DOM versions
(and subsequently also this library's CSSElement
) directly have
matches
methods, which makes the CSSElement.getSelectorMatcher()
method a bit superfluous, although it is being kept for now.
-
Method Summary
Modifier and TypeMethodDescriptionGet the pseudo-element that this matcher will use to match selectors.boolean
Does this object match the given selector?int
matches
(SelectorList selist) Does this object match the given selector list?void
setPseudoElement
(Condition pseudoElt) Set this selector's pseudo-element.
-
Method Details
-
getPseudoElement
Condition getPseudoElement()Get the pseudo-element that this matcher will use to match selectors.- Returns:
- the pseudo-element condition, or
null
if no pseudo-element will be used to match selectors.
-
setPseudoElement
Set this selector's pseudo-element.- Parameters:
pseudoElt
- the pseudo-element condition, ornull
if none.
-
matches
Does this object match the given selector list?- Parameters:
selist
- the list of selectors to which this matcher will compare.- Returns:
- the index of the highest matching selector, or -1 if none matches.
-
matches
Does this object match the given selector?- Parameters:
selector
- the selector to be tested.- Returns:
true
if this matcher matches this object,false
otherwise.
-