Class SelectNothingSelector


public class SelectNothingSelector extends SimpleSelector
A "select nothing selector" matches nothing.

This selector is used, when the parser does not understand the syntax of the selector.

Author:
Werner Randelshofer
  • Constructor Details

  • Method Details

    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object
    • match

      public <T> @Nullable T match(SelectorModel<T> model, 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
    • getSpecificity

      public int getSpecificity()
      Description copied from class: Selector
      Returns the specificity of this selector.

      A selector's specificity is calculated as follows:

      • count the number of ID selectors in the selector (= a)
      • count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)
      • count the number of type selectors and pseudo-elements in the selector (= c)
      • ignore the universal selector

      Selectors inside the negation pseudo-class are counted like any other, but the negation itself does not count as a pseudo-class.

      Concatenating the three numbers a-b-c (in a number system with a large base) gives the specificity.

      In this implementation we compute specificity with specificity=100*a+10*b+c.

      References:

      CSS Syntax Selectors Level 3, Chapter 9. Calculating a selector's specificity
      w3.org
      Specified by:
      getSpecificity in class Selector
      Returns:
      the specificity
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object