Interface DomNode

All Known Subinterfaces:
DomElement

@JsType(isNative=true) public interface DomNode
Node that has all methods from Node API that have been overridden in Polymer DOM module.

No instances of this class should be created directly, but instead DomApi.wrap(elemental.dom.Node) should be used

Since:
1.0
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendChild(elemental.dom.Node node)
    Insert a node as the last child node of this element.
    elemental.dom.Node
    cloneNode(boolean deep)
    Clone a Node, and optionally, all of its contents.
    JsArray<elemental.dom.Node>
    Returns the childNodes property.
    elemental.dom.Node
    Returns the firstChild property.
    elemental.dom.Node
    Returns the lastChild property.
    elemental.dom.Node
    Returns the nextSibling property.
    elemental.dom.Node
    Gets the parent node of this node.
    elemental.dom.Node
    Returns the previousSibling property.
    Returns the textContent property.
    void
    insertBefore(elemental.dom.Node newChild, elemental.dom.Node refChild)
    Inserts the first Node given in a parameter immediately before the second, child of this element, Node.
    boolean
    isSameNode(elemental.dom.Node node)
    The isSameNode() method for Node objects is a legacy alias the for the === strict equality operator.
    void
    removeChild(elemental.dom.Node childNode)
    Removes a child node from the current node, which much be a child of the current node.
    void
    replaceChild(elemental.dom.Node newChild, elemental.dom.Node oldChild)
    Replaces one child Node of the current one with the second one given in parameter.
    void
    setTextContent(String textContent)
    A setter for the childNodes property.
  • Method Details

    • getChildNodes

      @JsProperty JsArray<elemental.dom.Node> getChildNodes()
      Returns the childNodes property.

      NOTE: returns an array since that is what the Polymer.dom API does, and luckily native NodeList items can be accessed array like with list[index].

      This means that only JsArray.get(int) and JsArray.length() methods can be used from the returned "array".

      Returns:
      the child nodes
    • getFirstChild

      @JsProperty elemental.dom.Node getFirstChild()
      Returns the firstChild property.
      Returns:
      the first child
    • getLastChild

      @JsProperty elemental.dom.Node getLastChild()
      Returns the lastChild property.
      Returns:
      the last child
    • getNextSibling

      @JsProperty elemental.dom.Node getNextSibling()
      Returns the nextSibling property.
      Returns:
      the next sibling
    • getPreviousSibling

      @JsProperty elemental.dom.Node getPreviousSibling()
      Returns the previousSibling property.
      Returns:
      the previous sibling
    • getTextContent

      @JsProperty String getTextContent()
      Returns the textContent property.
      Returns:
      the text content
    • setTextContent

      @JsProperty void setTextContent(String textContent)
      A setter for the childNodes property.
      Parameters:
      textContent - the text content to set
    • appendChild

      void appendChild(elemental.dom.Node node)
      Insert a node as the last child node of this element.
      Parameters:
      node - the node to append
    • insertBefore

      void insertBefore(elemental.dom.Node newChild, elemental.dom.Node refChild)
      Inserts the first Node given in a parameter immediately before the second, child of this element, Node.
      Parameters:
      newChild - the node to be inserted
      refChild - the node before which newChild is inserted
    • removeChild

      void removeChild(elemental.dom.Node childNode)
      Removes a child node from the current node, which much be a child of the current node.
      Parameters:
      childNode - the child node to remove
    • replaceChild

      void replaceChild(elemental.dom.Node newChild, elemental.dom.Node oldChild)
      Replaces one child Node of the current one with the second one given in parameter.
      Parameters:
      newChild - the new node to replace the oldChild. If it already exists in the DOM, it is first removed.
      oldChild - is the existing child to be replaced.
    • cloneNode

      elemental.dom.Node cloneNode(boolean deep)
      Clone a Node, and optionally, all of its contents. By default, it clones the content of the node.
      Parameters:
      deep - true if the children of the node should also be cloned, or false to clone only the specified node.
      Returns:
      a clone of this node
    • getParentNode

      @JsProperty elemental.dom.Node getParentNode()
      Gets the parent node of this node.
      Returns:
      the parent node, not null if this node has no parent.
    • isSameNode

      boolean isSameNode(elemental.dom.Node node)
      The isSameNode() method for Node objects is a legacy alias the for the === strict equality operator. That is, it tests whether two nodes are the same (in other words, whether they reference the same object).
      Parameters:
      node - the node to test
      Returns:
      whether the nodes are the same