Class DOMElement

java.lang.Object
io.sf.carte.doc.dom.DOMElement
All Implemented Interfaces:
DOMNode, NonDocumentTypeChildNode, ParentNode, CSSElement, CSSNode, Serializable, Element, Node
Direct Known Subclasses:
HTMLElement

public abstract class DOMElement extends Object implements CSSElement, ParentNode
A bare DOM element node.
See Also:
  • Method Details

    • getAttributes

      public AttributeNamedNodeMap getAttributes()
      Specified by:
      getAttributes in interface Node
    • hasAttributes

      public boolean hasAttributes()
      Specified by:
      hasAttributes in interface Node
    • getAttribute

      public String getAttribute(String name)
      Specified by:
      getAttribute in interface Element
    • getAttributeNS

      public String getAttributeNS(String namespaceURI, String localName) throws DOMException
      Specified by:
      getAttributeNS in interface Element
      Throws:
      DOMException
    • getAttributeNode

      public Attr getAttributeNode(String name)
      Specified by:
      getAttributeNode in interface Element
    • getAttributeNodeNS

      public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException
      Specified by:
      getAttributeNodeNS in interface Element
      Throws:
      DOMException
    • hasAttribute

      public boolean hasAttribute(String name)
      Specified by:
      hasAttribute in interface Element
    • hasAttributeNS

      public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException
      Specified by:
      hasAttributeNS in interface Element
      Throws:
      DOMException
    • removeAttribute

      public void removeAttribute(String name) throws DOMException
      Specified by:
      removeAttribute in interface Element
      Throws:
      DOMException
    • removeAttributeNS

      public void removeAttributeNS(String namespaceURI, String localName) throws DOMException
      Specified by:
      removeAttributeNS in interface Element
      Throws:
      DOMException
    • removeAttributeNode

      public Attr removeAttributeNode(Attr oldAttr) throws DOMException
      Specified by:
      removeAttributeNode in interface Element
      Throws:
      DOMException
    • setAttribute

      public void setAttribute(String name, String value) throws DOMException
      Specified by:
      setAttribute in interface Element
      Throws:
      DOMException
    • setAttributeNS

      public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException
      Specified by:
      setAttributeNS in interface Element
      Throws:
      DOMException
    • setAttributeNode

      public Attr setAttributeNode(Attr newAttr) throws DOMException
      Specified by:
      setAttributeNode in interface Element
      Throws:
      DOMException
    • setAttributeNodeNS

      public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
      Specified by:
      setAttributeNodeNS in interface Element
      Throws:
      DOMException
    • getId

      public String getId()
      Description copied from interface: CSSElement
      Gets the id attribute of this element.
      Specified by:
      getId in interface CSSElement
      Returns:
      the id attribute, or the empty string if has no ID.
    • setIdAttribute

      @Deprecated public void setIdAttribute(String name, boolean isId)
      Deprecated.
      Specified by:
      setIdAttribute in interface Element
    • setIdAttributeNS

      @Deprecated public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
      Deprecated.
      Specified by:
      setIdAttributeNS in interface Element
    • setIdAttributeNode

      @Deprecated public void setIdAttributeNode(Attr idAttr, boolean isId)
      Deprecated.
      Specified by:
      setIdAttributeNode in interface Element
    • getElementsByTagNameNS

      public ElementList getElementsByTagNameNS(String namespaceURI, String localName)
      Description copied from interface: ParentNode
      Gives an ElementList of all the elements descending from this context node that have the given local name and namespace URI, in document order.

      The list is a live collection, and changes to the document made after calling this method are reflected in the ElementList.

      The most efficient way to browse the returned list is to iterate it.

      Specified by:
      getElementsByTagNameNS in interface Element
      Specified by:
      getElementsByTagNameNS in interface ParentNode
      Parameters:
      namespaceURI - the namespace URI of the elements to match on. The special value "*" matches all namespaces.
      localName - The local name of the elements to match on. The special value "*" matches all local names.
      Returns:
      the ElementList object containing all the matched elements.
    • getElementsByTagName

      public ElementList getElementsByTagName(String name)
      Description copied from interface: ParentNode
      Gives an ElementList of all the elements descending from this context node that have the given tag name, in document order.

      The list is a live collection, and changes to the document made after calling this method are reflected in the ElementList.

      The most efficient way to browse the returned list is to iterate it.

      Specified by:
      getElementsByTagName in interface Element
      Specified by:
      getElementsByTagName in interface ParentNode
      Parameters:
      name - The tag name of the elements to match on. The special value "*" matches all tag names.
      Returns:
      the ElementList object containing all the matched elements.
    • getClassList

      public DOMTokenList getClassList()
      Gives a live DOMTokenList collection of the class attributes of this element.

      Any modification to the returned list changes the value of the class attribute of this element, and vice-versa.

      Returns:
      the DOMTokenList ordered collection of the class attributes of this element.
    • getElementsByClassName

      public ElementList getElementsByClassName(String names)
      Gives a live NodeList containing all child elements which have all of the given class names under this reference element.
      Specified by:
      getElementsByClassName in interface ParentNode
      Parameters:
      names - the names of the classes, separated by whitespace.
      Returns:
      the live NodeList containing all child elements which have all of the given class names under this reference element.
    • getClassName

      public String getClassName()
    • setClassName

      public void setClassName(String className)
    • querySelector

      public DOMElement querySelector(String selectors)
      Returns the first element that is a descendant of this node and matches the given selector list.
      Parameters:
      selectors - a comma-separated list of selectors.
      Returns:
      the first element matching the selectors.
    • querySelectorAll

      public ElementList querySelectorAll(String selectors)
      Gets a static list of the descendant elements that match any of the specified group of selectors.

      Unlike methods like getElementsByTagName(String) or getElementsByClassName(String), this is not a live list but a static one, representing the state of the document when the method was called. If no elements match, the list will be empty. This element is not included in the query.

      Specified by:
      querySelectorAll in interface ParentNode
      Parameters:
      selectors - a comma-separated list of selectors.
      Returns:
      an ElementList with the elements that match any of the specified group of selectors.
    • getLocalName

      public String getLocalName()
      Gives the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, this is always null.
      Specified by:
      getLocalName in interface Node
      Returns:
      the local part of the qualified name of this node, or null if this node is not an ELEMENT_NODE nor an ATTRIBUTE_NODE.
    • getTagName

      public String getTagName()
      The name of the element (qualified if there is a namespace prefix). The name is case-preserving.
      Specified by:
      getTagName in interface Element
    • getNodeName

      public String getNodeName()
      Specified by:
      getNodeName in interface Node
    • lookupNamespaceURI

      public String lookupNamespaceURI(String prefix)
      Specified by:
      lookupNamespaceURI in interface Node
    • lookupPrefix

      public String lookupPrefix(String namespaceURI)
      Specified by:
      lookupPrefix in interface Node
    • getFirstElementChild

      public DOMElement getFirstElementChild()
      Gets the DOMElement that is the first child of this DOMElement.
      Specified by:
      getFirstElementChild in interface ParentNode
      Returns:
      the DOMElement that is the first child of this DOMElement, or null if there is none.
    • getLastElementChild

      public DOMElement getLastElementChild()
      Gets the DOMElement that is the last child of this DOMElement.
      Specified by:
      getLastElementChild in interface ParentNode
      Returns:
      the DOMElement that is the last child of this DOMElement, or null if there is none.
    • getChildren

      public ElementList getChildren()
      Gets the live ElementList containing all nodes of type Element that are children of this Element.
      Specified by:
      getChildren in interface ParentNode
      Returns:
      the ElementList containing all nodes of type Element that are children of this Element.
    • getChildElementCount

      public int getChildElementCount()
      Gets the number of child nodes of type Element that this parent node has.
      Specified by:
      getChildElementCount in interface ParentNode
      Returns:
      the number of child nodes of type Element that this Element has.
    • iterator

      public Iterator<DOMNode> iterator()
      Creates a new iterator over the child nodes.
      Specified by:
      iterator in interface ParentNode
      Returns:
      an iterator over the child nodes.
    • descendingIterator

      public Iterator<DOMNode> descendingIterator()
      Creates a new iterator descending over the child nodes, starting from the last child node.
      Specified by:
      descendingIterator in interface ParentNode
      Returns:
      an iterator descending over the child nodes.
    • iterator

      public Iterator<DOMNode> iterator(BitSet whatToShow)
      Creates a new iterator over the child nodes.

      It only iterates over types set in the whatToShow bit field.

      Example:

            BitSet mask = new BitSet(32);
            mask.set(Node.ELEMENT_NODE);
            Iterator<Node> it = node.iterator(mask);
       
      Specified by:
      iterator in interface ParentNode
      Parameters:
      whatToShow - a bit set.
      Returns:
      an iterator over the child nodes.
    • elementIterator

      public Iterator<DOMElement> elementIterator()
      Creates a new iterator over the child elements.
      Specified by:
      elementIterator in interface ParentNode
      Returns:
      an iterator over the child elements.
    • elementIterator

      public Iterator<DOMElement> elementIterator(String name)
      Creates a new iterator over the child elements of the given tagname.
      Specified by:
      elementIterator in interface ParentNode
      Parameters:
      name - The tag name of the child elements to match on.
      Returns:
      an iterator over the child elements.
    • elementIteratorNS

      public Iterator<DOMElement> elementIteratorNS(String namespaceURI, String localName)
      Creates a new iterator over the child elements of the given namespaceURI and localName.
      Specified by:
      elementIteratorNS in interface ParentNode
      Parameters:
      namespaceURI - the namespace URI of the elements to match on.
      localName - The local name of the elements to match on.
      Returns:
      an iterator over the child elements.
    • iterator

      public Iterator<DOMNode> iterator(int whatToShow, NodeFilter filter)
      Creates a new iterator over the child nodes.

      It only iterates over types set in the whatToShow mask that satisfy the custom NodeFilter.

      Example:

       Iterator<Node> it = node.iterator(NodeFilter.SHOW_ELEMENT, null);
       
      Specified by:
      iterator in interface ParentNode
      Parameters:
      whatToShow - the bit field mask to apply to the node types, see NodeFilter. Do not confuse this argument with the short argument of the ParentNode.typeIterator(short) method.
      filter - the filter to use in the iteration. if null, only the whatToShow mask filter is applied.
      Returns:
      an iterator over the child nodes.
    • typeIterator

      public Iterator<DOMNode> typeIterator(short typeToShow)
      Creates a new iterator over the child nodes.

      Do not confuse the typeToShow argument with the int argument of the ParentNode.iterator(int, NodeFilter) method, which is a bit field.

      Specified by:
      typeIterator in interface ParentNode
      Parameters:
      typeToShow - the node type to show (from Node.getNodeType()).
      Returns:
      an iterator over the child nodes.
    • iterator

      public Iterator<DOMNode> iterator(NodeFilter filter)
      Creates a new iterator over the child nodes.

      It only iterates over nodes accepted by the filter.

      Specified by:
      iterator in interface ParentNode
      Parameters:
      filter - a filter, see NodeFilter.
      Returns:
      an iterator over the child nodes.
    • listIterator

      public NodeListIterator listIterator()
      Creates a new list iterator over the child nodes.
      Specified by:
      listIterator in interface ParentNode
      Returns:
      a list iterator over the child nodes.
    • getTextContent

      public String getTextContent() throws DOMException
      Specified by:
      getTextContent in interface Node
      Throws:
      DOMException
    • getInnerText

      public String getInnerText()
      Gives a representation of the text content of an element, approximately as if it was rendered according to the styling and the document language.

      This method is computationally more expensive than getTextContent().

      Returns:
      a representation of the text content of an element.
      Throws:
      StyleDatabaseRequiredException - if style computations require a style database which is not present.
    • getSelectorMatcher

      public SelectorMatcher getSelectorMatcher()
      Gets a selector matcher associated to this element.
      Specified by:
      getSelectorMatcher in interface CSSElement
      Returns:
      a selector matcher associated to this element.
    • matches

      public boolean matches(String selectorString, String pseudoElement) throws DOMException
      Does this element (with the provided pseudo-element, if any) match the provided selector string ?
      Specified by:
      matches in interface CSSElement
      Parameters:
      selectorString - the selector string.
      pseudoElement - the pseudo-element, or null if none.
      Returns:
      true if the element would be selected by the specified selector string, false otherwise.
      Throws:
      DOMException - SYNTAX_ERR if there was an error parsing the selector string.
    • matches

      public boolean matches(SelectorList selist, Condition pseudoElement)
      Does this element (with the provided pseudo-element, if any) match the provided selector list ?
      Specified by:
      matches in interface CSSElement
      Parameters:
      selist - the selector list.
      pseudoElement - the pseudo-element condition, or null if none.
      Returns:
      true if the element would be selected by at least one selector in the specified list, false otherwise.
    • getStyle

      public CSSStyleDeclaration getStyle()
      The inline style.
      Specified by:
      getStyle in interface CSSElement
      Returns:
      the inline style specified by the style attribute, or null if that attribute is not present.
    • hasOverrideStyle

      public boolean hasOverrideStyle(Condition pseudoElt)
      Check whether this element has an override style declaration for the given pseudo-element.

      This method allows checking for override styles without the overhead of producing and retrieving one with CSSElement.getOverrideStyle(Condition) and checking its length.

      Specified by:
      hasOverrideStyle in interface CSSElement
      Parameters:
      pseudoElt - the pseudo-element condition, or null if none.
      Returns:
      true if this element has an override style declaration for pseudoElt.
    • getOverrideStyle

      public CSSStyleDeclaration getOverrideStyle(Condition pseudoElt)
      Gets this element's override style declaration for a pseudo-element.

      The getOverrideStyle method provides a mechanism through which a DOM author could effect immediate change to the style of an element without modifying the explicitly linked style sheets of a document or the inline style of elements.

      The override style sheet comes after the author style sheet in the cascade algorithm.

      Specified by:
      getOverrideStyle in interface CSSElement
      Parameters:
      pseudoElt - the pseudo-element condition, or null if none.
      Returns:
      the override style sheet for the given pseudo-element.
    • hasPresentationalHints

      public boolean hasPresentationalHints()
      Check whether this element has non-CSS presentational hints.

      A document may contain non-CSS presentational hints (like the width attribute in HTML). This method can return true only if this specific element do contain such hints, which can be exported to a style declaration by using the CSSElement.exportHintsToStyle(CSSStyleDeclaration) method.

      Specified by:
      hasPresentationalHints in interface CSSElement
      Returns:
      true if this element has presentational hints.
    • exportHintsToStyle

      public void exportHintsToStyle(CSSStyleDeclaration style)
      Export this element's non-CSS presentational hints (if any) to the supplied CSSStyleDeclaration.
      Specified by:
      exportHintsToStyle in interface CSSElement
      Parameters:
      style - the style declaration to export to.
    • getComputedStyle

      public ComputedCSSStyle getComputedStyle(String pseudoElt)
      Gets the computed style declaration that applies to this element.
      Specified by:
      getComputedStyle in interface CSSElement
      Parameters:
      pseudoElt - the pseudo-element name.
      Returns:
      the computed style declaration.
    • cloneNode

      public abstract DOMElement cloneNode(boolean deep)
      Specified by:
      cloneNode in interface Node
    • getStartTag

      public String getStartTag()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSchemaTypeInfo

      public TypeInfo getSchemaTypeInfo()
      Specified by:
      getSchemaTypeInfo in interface Element
    • getNamespaceURI

      public String getNamespaceURI()
      Specified by:
      getNamespaceURI in interface Node
    • getPrefix

      public String getPrefix()
      Specified by:
      getPrefix in interface Node
    • setPrefix

      public void setPrefix(String prefix) throws DOMException
      Specified by:
      setPrefix in interface Node
      Throws:
      DOMException
    • hasChildNodes

      public boolean hasChildNodes()
      Description copied from interface: DOMNode
      Does this node have any child nodes ?
      Specified by:
      hasChildNodes in interface DOMNode
      Specified by:
      hasChildNodes in interface Node
      Returns:
      true if this node has child nodes, false otherwise.
    • getPreviousElementSibling

      public DOMElement getPreviousElementSibling()
      Description copied from interface: NonDocumentTypeChildNode
      Gets the first preceding sibling that is an element.
      Specified by:
      getPreviousElementSibling in interface NonDocumentTypeChildNode
      Returns:
      the first preceding sibling that is an element, and null otherwise.
    • getNextElementSibling

      public DOMElement getNextElementSibling()
      Description copied from interface: NonDocumentTypeChildNode
      Gets the first following sibling that is an element.
      Specified by:
      getNextElementSibling in interface NonDocumentTypeChildNode
      Returns:
      the first following sibling that is an element, and null otherwise.
    • prependChild

      public DOMNode prependChild(Node newChild) throws DOMException
      Throws:
      DOMException
    • getNodeValue

      public String getNodeValue() throws DOMException
      Specified by:
      getNodeValue in interface Node
      Throws:
      DOMException
    • setNodeValue

      public void setNodeValue(String nodeValue) throws DOMException
      Specified by:
      setNodeValue in interface Node
      Throws:
      DOMException
    • getNodeType

      public short getNodeType()
      Specified by:
      getNodeType in interface Node
    • getParentNode

      public DOMNode getParentNode()
      Specified by:
      getParentNode in interface DOMNode
      Specified by:
      getParentNode in interface Node
    • getChildNodes

      public DOMNodeList getChildNodes()
      Description copied from interface: DOMNode
      Get the children of this node.
      Specified by:
      getChildNodes in interface DOMNode
      Specified by:
      getChildNodes in interface Node
      Returns:
      a DOMNodeList with the children of this node. If there are no children, an empty list is returned.
    • getFirstChild

      public DOMNode getFirstChild()
      Description copied from interface: DOMNode
      Get the first child of this node.
      Specified by:
      getFirstChild in interface DOMNode
      Specified by:
      getFirstChild in interface Node
      Returns:
      the first child of this node, null if has no child nodes.
    • getLastChild

      public DOMNode getLastChild()
      Description copied from interface: DOMNode
      Get the last child of this node.
      Specified by:
      getLastChild in interface DOMNode
      Specified by:
      getLastChild in interface Node
      Returns:
      the last child of this node, null if has no child nodes.
    • getPreviousSibling

      public DOMNode getPreviousSibling()
      Description copied from interface: DOMNode
      Get the node immediately preceding this node in its parent's child list.
      Specified by:
      getPreviousSibling in interface DOMNode
      Specified by:
      getPreviousSibling in interface Node
      Returns:
      the node immediately preceding this node in the child list, or null if none.
    • getNextSibling

      public DOMNode getNextSibling()
      Description copied from interface: DOMNode
      Get the node immediately following this node in its parent's child list.
      Specified by:
      getNextSibling in interface DOMNode
      Specified by:
      getNextSibling in interface Node
      Returns:
      the node immediately following this node in the child list, or null if none.
    • appendChild

      public DOMNode appendChild(Node newChild) throws DOMException
      Description copied from interface: DOMNode
      Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.
      Specified by:
      appendChild in interface DOMNode
      Specified by:
      appendChild in interface Node
      Parameters:
      newChild - the node to append. If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node.
      Returns:
      the appended node.
      Throws:
      DOMException - HIERARCHY_REQUEST_ERR: raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second DocumentType or Element node.
      WRONG_DOCUMENT_ERR: if newChild was created from a different document than the one that created this node.
      NOT_SUPPORTED_ERR: if this implementation does not support children of the type of newChild at this node.
    • insertBefore

      public DOMNode insertBefore(Node newChild, Node refChild) throws DOMException
      Inserts the node newChild right before node refChild in the child node list.
      • If refChild is null, newChild is appended at the end of the child list.
      • If the newChild is already in the tree, it is first removed.
      • Inserting a node before itself has no effect.
      Specified by:
      insertBefore in interface DOMNode
      Specified by:
      insertBefore in interface Node
      Parameters:
      newChild - the node to put at the child node list, before refChild. If it is a DocumentFragment object, the entire contents of the document fragment are inserted into the child list of this node.
      refChild - the node before which newChild must be inserted.
      Returns:
      the inserted node.
      Throws:
      DOMException - HIERARCHY_REQUEST_ERR: raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second DocumentType or Element node.
      WRONG_DOCUMENT_ERR: if newChild was created from a different document than the one that created this node.
      NOT_FOUND_ERR: if refChild is not a child of this node.
      NOT_SUPPORTED_ERR: if this implementation does not support children of the type of newChild at this node.
    • replaceChild

      public DOMNode replaceChild(Node newChild, Node oldChild) throws DOMException
      Replaces the node oldChild with newChild. If the newChild is already in the tree, it is first removed.

      Replacing a node with itself has no effect.

      Specified by:
      replaceChild in interface DOMNode
      Specified by:
      replaceChild in interface Node
      Parameters:
      newChild - the node to put at the child node list, in place of oldChild. If it is a DocumentFragment object, the entire contents of the document fragment are inserted into the child list of this node.
      oldChild - the node being replaced.
      Returns:
      the replaced (old) node.
      Throws:
      DOMException - HIERARCHY_REQUEST_ERR: raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second DocumentType or Element node.
      WRONG_DOCUMENT_ERR: if newChild was created from a different document than the one that created this node.
      NOT_FOUND_ERR: if oldChild is not a child of this node.
      NOT_SUPPORTED_ERR: if this implementation does not support children of the type of newChild at this node.
    • removeChild

      public DOMNode removeChild(Node oldChild) throws DOMException
      Description copied from interface: DOMNode
      Removes the node oldChild from the children of this node.
      Specified by:
      removeChild in interface DOMNode
      Specified by:
      removeChild in interface Node
      Parameters:
      oldChild - the node to remove.
      Returns:
      the removed node.
      Throws:
      DOMException - NOT_FOUND_ERR: if oldChild is not a child of this node.
    • removeAllChild

      public void removeAllChild()
      Description copied from interface: DOMNode
      Removes all the children from this node, if any.
      Specified by:
      removeAllChild in interface DOMNode
    • setUserData

      public Object setUserData(String key, Object data, UserDataHandler handler)
      Specified by:
      setUserData in interface Node
    • getUserData

      public Object getUserData(String key)
      Specified by:
      getUserData in interface Node
    • normalize

      public void normalize()
      Specified by:
      normalize in interface Node
    • getFeature

      @Deprecated public Object getFeature(String feature, String version)
      Deprecated.
      This method is deprecated and not supported.
      Specified by:
      getFeature in interface Node
      Parameters:
      feature - ignored.
      version - ignored.
      Returns:
      null.
    • isSupported

      @Deprecated public boolean isSupported(String feature, String version)
      Deprecated.
      This method is not supported.
      Specified by:
      isSupported in interface Node
      Parameters:
      feature - ignored.
      version - ignored.
      Returns:
      Always true.
    • compareDocumentPosition

      public short compareDocumentPosition(Node other) throws DOMException
      Specified by:
      compareDocumentPosition in interface Node
      Throws:
      DOMException
    • setTextContent

      public void setTextContent(String textContent) throws DOMException
      Specified by:
      setTextContent in interface Node
      Throws:
      DOMException
    • isDefaultNamespace

      public boolean isDefaultNamespace(String namespaceURI)
      Specified by:
      isDefaultNamespace in interface Node
    • isEqualNode

      public boolean isEqualNode(Node arg)
      Specified by:
      isEqualNode in interface Node
    • isSameNode

      public boolean isSameNode(Node other)
      Specified by:
      isSameNode in interface Node
    • contains

      public boolean contains(Node node)
      Test if node is an inclusive descendant of this node.
      Parameters:
      node - the node to test.
      Returns:
      true if node is an inclusive descendant of this node, false otherwise (including node being null).
    • getOwnerDocument

      public abstract DOMDocument getOwnerDocument()
      Get the DOMDocument object related to this node (for all nodes except DocumentType, it is the document that created it), which is also the object that should be used to create new nodes for the document.
      Specified by:
      getOwnerDocument in interface CSSNode
      Specified by:
      getOwnerDocument in interface DOMNode
      Specified by:
      getOwnerDocument in interface Node
      Returns:
      the DOMDocument object corresponding to this node. When this node is a DOMDocument or a DocumentType which was not added to any DOMDocument yet, this is null.