Class EvaluatorInternals

java.lang.Object
org.jsoup.select.EvaluatorInternals

public final class EvaluatorInternals extends Object
Shared query operations for Element, Collector, and StreamParser. Public for access between jsoup packages; not a supported user API. String-query methods report compatibility differences when in check mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Evaluator
    byId(String id)
    Matches ID values exactly for Element.getElementById(String), even in quirks mode.
    static @Nullable Element
    closest(String query, Element element)
    Returns the element if it matches the query, or its nearest matching ancestor.
    static @Nullable Element
    closest(Evaluator evaluator, Element element)
    Returns the element if it matches the evaluator, or its nearest matching ancestor.
    static boolean
    matches(String query, Element element)
    Tests whether the supplied element matches the query.
    static boolean
    matches(Evaluator evaluator, Element element)
    Tests the element itself, using it as :scope in Web mode.
    static Stream<Element>
    stream(Evaluator evaluator, Element root, Stream<Element> candidates)
    Filters candidates using the evaluator's captured query mode, excluding root in Web mode.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • stream

      public static Stream<Element> stream(Evaluator evaluator, Element root, Stream<Element> candidates)
      Filters candidates using the evaluator's captured query mode, excluding root in Web mode.
    • byId

      public static Evaluator byId(String id)
      Matches ID values exactly for Element.getElementById(String), even in quirks mode.
    • matches

      public static boolean matches(String query, Element element)
      Tests whether the supplied element matches the query.
    • closest

      public static @Nullable Element closest(String query, Element element)
      Returns the element if it matches the query, or its nearest matching ancestor.
    • matches

      public static boolean matches(Evaluator evaluator, Element element)
      Tests the element itself, using it as :scope in Web mode.
    • closest

      public static @Nullable Element closest(Evaluator evaluator, Element element)
      Returns the element if it matches the evaluator, or its nearest matching ancestor. In Web mode, :scope remains the supplied element.