Class DocumentFragment

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.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:
    W3C Dom Level 1, Serialized Form
    • Constructor Detail

      • DocumentFragment

        public DocumentFragment()
        Creates an instance.
    • Method Detail

      • jsConstructor

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

        public NodeList querySelectorAll​(java.lang.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​(java.lang.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 java.lang.Object getDefaultValue​(java.lang.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
      • getElementById

        public HtmlUnitScriptable getElementById​(java.lang.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 java.lang.Object getRootNode()
        Returns the owner document.
        Overrides:
        getRootNode in class Node
        Returns:
        the document