Class PseudoClassSelector

  • All Implemented Interfaces:
    NodeFilter, NodeListFilter

    public class PseudoClassSelector
    extends Selector
    implements NodeFilter, NodeListFilter
    Pseudo class selector. A pseudo-class always consists of a "colon" (:) followed by the name of the pseudo-class and optionally by a value between parentheses.

    Selectors introduces the concept of structural pseudo-classes to permit selection based on extra information that lies in the document tree but cannot be represented by other simple selectors or combinators.

    Standalone text and other non-element nodes are not counted when calculating the position of an element in the list of children of its parent. When calculating the position of an element in the list of children of its parent, the index numbering starts at 1.

    • Field Detail

      • PSEUDO_CLASS_MAP

        protected static final java.util.Map<java.lang.String,​PseudoClass> PSEUDO_CLASS_MAP
    • Constructor Detail

      • PseudoClassSelector

        public PseudoClassSelector​(java.lang.String pseudoClassName)
    • Method Detail

      • registerPseudoClass

        public static void registerPseudoClass​(java.lang.Class<? extends PseudoClass> pseudoClassType)
        Registers pseudo class.
      • lookupPseudoClass

        public static PseudoClass lookupPseudoClass​(java.lang.String pseudoClassName)
        Lookups pseudo class for given pseudo class name.
      • accept

        public boolean accept​(Node node)
        Matches node to this selector.
        Specified by:
        accept in interface NodeFilter
      • accept

        public boolean accept​(java.util.List<Node> currentResults,
                              Node node,
                              int index)
        Accepts node within selected results. Invoked after results are matched.
        Specified by:
        accept in interface NodeListFilter