Package com.vaadin.client.flow.dom
Interface DomNode
-
- All Known Subinterfaces:
DomElement
@JsType(isNative=true) public interface DomNodeNode 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidappendChild(elemental.dom.Node node)Insert a node as the last child node of this element.elemental.dom.NodecloneNode(boolean deep)Clone a Node, and optionally, all of its contents.JsArray<elemental.dom.Node>getChildNodes()Returns thechildNodesproperty.elemental.dom.NodegetFirstChild()Returns thefirstChildproperty.elemental.dom.NodegetLastChild()Returns thelastChildproperty.elemental.dom.NodegetNextSibling()Returns thenextSiblingproperty.elemental.dom.NodegetParentNode()Gets the parent node of this node.elemental.dom.NodegetPreviousSibling()Returns thepreviousSiblingproperty.StringgetTextContent()Returns thetextContentproperty.voidinsertBefore(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.booleanisSameNode(elemental.dom.Node node)The isSameNode() method for Node objects is a legacy alias the for the === strict equality operator.voidremoveChild(elemental.dom.Node childNode)Removes a child node from the current node, which much be a child of the current node.voidreplaceChild(elemental.dom.Node newChild, elemental.dom.Node oldChild)Replaces one child Node of the current one with the second one given in parameter.voidsetTextContent(String textContent)A setter for thechildNodesproperty.
-
-
-
Method Detail
-
getChildNodes
@JsProperty JsArray<elemental.dom.Node> getChildNodes()
Returns thechildNodesproperty.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)andJsArray.length()methods can be used from the returned "array".- Returns:
- the child nodes
-
getFirstChild
@JsProperty elemental.dom.Node getFirstChild()
Returns thefirstChildproperty.- Returns:
- the first child
-
getLastChild
@JsProperty elemental.dom.Node getLastChild()
Returns thelastChildproperty.- Returns:
- the last child
-
getNextSibling
@JsProperty elemental.dom.Node getNextSibling()
Returns thenextSiblingproperty.- Returns:
- the next sibling
-
getPreviousSibling
@JsProperty elemental.dom.Node getPreviousSibling()
Returns thepreviousSiblingproperty.- Returns:
- the previous sibling
-
getTextContent
@JsProperty String getTextContent()
Returns thetextContentproperty.- Returns:
- the text content
-
setTextContent
@JsProperty void setTextContent(String textContent)
A setter for thechildNodesproperty.- 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 insertedrefChild- 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-trueif the children of the node should also be cloned, orfalseto 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
nullif 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
-
-