Class DashMatchSelector


public class DashMatchSelector extends AbstractAttributeSelector
A "dash match selector" |= matches an element if the element has an attribute with the specified name and its value is either exactly the specified substring or its value begins with the specified substring immediately followed by a dash '-' character. This is primarily intended to allow language subcode matches.
Author:
Werner Randelshofer
  • Constructor Details

    • DashMatchSelector

      public DashMatchSelector(@Nullable SourceLocator sourceLocator, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring)
      Creates a new instance.
      Parameters:
      sourceLocator - source locator for debugging
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      attributeName - the attribute name
      substring - the substring in the attribute value
  • Method Details

    • match

      protected <T> @Nullable T match(@NonNull SelectorModel<T> model, @NonNull T element)
      Description copied from class: Selector
      Returns the matching element.
      Specified by:
      match in class Selector
      Type Parameters:
      T - element type
      Parameters:
      model - The helper is used to access properties of the element and parent or sibling elements in the document.
      element - the element
      Returns:
      the matching element or null
    • produceTokens

      public void produceTokens(@NonNull Consumer<CssToken> consumer)
      Description copied from class: AbstractSyntaxTree
      Produces tokens for the subtree starting at this tree node.
      Overrides:
      produceTokens in class AbstractSyntaxTree
      Parameters:
      consumer - a consumer for the tokens
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object