Class DocumentFragment

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable
Direct Known Subclasses:
ShadowRoot

public class DocumentFragment extends Node
A JavaScript object for DocumentFragment.
See Also:
  • Constructor Details

    • DocumentFragment

      public DocumentFragment()
      Creates an instance.
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
      Overrides:
      jsConstructor in class Node
    • querySelectorAll

      public NodeList querySelectorAll(String selectors)
      Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings. The NodeList object returned by the querySelectorAll() method must be static, not live.
      Parameters:
      selectors - the selectors
      Returns:
      the static node list
    • querySelector

      public Node querySelector(String selectors)
      Returns the first element within the document that matches the specified group of selectors.
      Parameters:
      selectors - the selectors
      Returns:
      null if no matches are found; otherwise, it returns the first matching element
    • getDefaultValue

      public Object getDefaultValue(Class<?> hint)
      Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.
      Specified by:
      getDefaultValue in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      getDefaultValue in class HtmlUnitScriptable
      Parameters:
      hint - a hint as to the format of the default value (ignored in this case)
      Returns:
      the default value
    • getChildElementCount

      public int getChildElementCount()
      Returns the current number of child elements.
      Overrides:
      getChildElementCount in class Node
      Returns:
      the child element count
    • getFirstElementChild

      public Element getFirstElementChild()
      Returns the first element child.
      Overrides:
      getFirstElementChild in class Node
      Returns:
      the first element child
    • getLastElementChild

      public Element getLastElementChild()
      Returns the last element child.
      Overrides:
      getLastElementChild in class Node
      Returns:
      the last element child
    • getChildren

      public HTMLCollection getChildren()
      Gets the children of the current node.
      Overrides:
      getChildren in class Node
      Returns:
      the child at the given position
      See Also:
    • getElementById

      public HtmlUnitScriptable getElementById(Object id)
      Returns the element with the specified ID, or null if that element could not be found.
      Parameters:
      id - the ID to search for
      Returns:
      the element, or null if it could not be found
    • getRootNode

      public Object getRootNode()
      Returns the owner document.
      Overrides:
      getRootNode in class Node
      Returns:
      the document