Class CssSelectorMatcher
java.lang.Object
dev.jcputney.mjml.css.CssSelectorMatcher
Matches CSS selectors against
HtmlElement nodes.
Supports all CSS2.1 selector types plus CSS3 attribute selectors. Pseudo-classes and pseudo-elements never match (they're preserved in style blocks, not inlined).
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasPseudo(CssSelector selector) Returns true if the selector contains pseudo-classes or pseudo-elements that cannot be inlined (e.g.static booleanmatches(CssSelector selector, HtmlElement element) Tests whether the given selector matches the given element.
-
Method Details
-
matches
Tests whether the given selector matches the given element.- Parameters:
selector- the CSS selector to testelement- the HTML element to test against- Returns:
trueif the selector matches the element
-
hasPseudo
Returns true if the selector contains pseudo-classes or pseudo-elements that cannot be inlined (e.g. :hover, ::before).- Parameters:
selector- the CSS selector to check- Returns:
trueif the selector contains any pseudo-class or pseudo-element
-