Class CssSelector
java.lang.Object
com.itextpdf.styledxmlparser.css.selector.AbstractCssSelector
com.itextpdf.styledxmlparser.css.selector.CssSelector
- All Implemented Interfaces:
-
ICssSelector
ICssSelector implementation for CSS selectors.
-
Field Summary
Fields inherited from class com.itextpdf.styledxmlparser.css.selector.AbstractCssSelector
selectorItems -
Constructor Summary
ConstructorsConstructorDescriptionCssSelector(String selector) Creates a newCssSelectorinstance.CssSelector(List<ICssSelectorItem> selectorItems) Creates a newCssSelectorinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a node matches the selector.booleanmatchesWithinScope(INode element, INode scope) Checks if the node matches this selector, but limits ancestor traversal so that it never goes above the providedscopenode.booleannotMatches(INode element) Checks if the node not matches all the selectors.Methods inherited from class com.itextpdf.styledxmlparser.css.selector.AbstractCssSelector
calculateSpecificity, getSelectorItems, toString
-
Constructor Details
-
CssSelector
Creates a newCssSelectorinstance.- Parameters:
-
selectorItems- the selector items
-
CssSelector
Creates a newCssSelectorinstance.- Parameters:
-
selector- the selector
-
-
Method Details
-
matches
Description copied from interface:ICssSelectorChecks if a node matches the selector.- Parameters:
-
element- the node - Returns:
- true, if the selector is a match for the node
-
matchesWithinScope
Checks if the node matches this selector, but limits ancestor traversal so that it never goes above the providedscopenode.This is primarily used to implement
:has(...)correctly: when matching a candidate descendant against an argument selector, ancestor combinators must not escape the:has()scope element.- Parameters:
-
element- the element to match -
scope- the scope boundary (inclusive). Ifnull, behaves likematches(INode). - Returns:
- true if the element matches within the given scope, false otherwise
-
notMatches
Checks if the node not matches all the selectors.- Parameters:
-
element- the node - Returns:
- true, if node doesn't match all the selectors
-