@JsType(isNative=true, name="Node", namespace="<global>") public abstract class BaseNode extends BaseEventTarget
BaseEventTarget.EventListenerCallback
Modifier | Constructor and Description |
---|---|
protected |
BaseNode()
To avoid any instantiation
|
Modifier and Type | Method and Description |
---|---|
BaseNode |
appendChild(BaseNode newChild)
Adds a node to the end of the list of children of a specified parent node.
If the given child is a reference to an existing node in the document, it moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node). |
BaseNode |
cloneNode(boolean deep)
Clone the node, and optionally, all of its contents.
|
NodeList<BaseNode> |
getChildNodes()
Returns a list containing all the children of this node.
|
BaseNode |
getFirstChild()
Returns a node representing the first direct child node of the node, or
null if the node has no child. |
BaseNode |
getLastChild()
Returns a node representing the last direct child node of the node, or
null if the node has no child. |
BaseNode |
getNextSibling()
Returns a node representing the next node in the tree, or
null if there isn't such node. |
String |
getNodeName()
Returns a string containing the name of the node.
The structure of the name will differ with the node type. |
NodeType |
getNodeType()
Returns the type of the node.
|
String |
getNodeValue()
Returns the value of the current node.
|
BaseDocument |
getOwnerDocument()
Returns the document that this node belongs to.
If the node is itself a document, returns null . |
BaseElement |
getParentElement()
Returns an element that is the parent of this node.
If the node has no parent, or if that parent is not an element, returns null . |
BaseNode |
getParentNode()
Returns a node that is the parent of this node.
If there is no such node, returns null . |
BaseNode |
getPreviousSibling()
Returns a node representing the previous node in the tree, or
null if there isn't such node. |
String |
getTextContent()
Returns the textual content of an element and all its descendants.
|
boolean |
hasChildNodes()
Returns a boolean indicating whether or not the element has any child nodes.
|
BaseNode |
insertBefore(BaseNode newChild,
BaseNode refChild)
Inserts a node before the reference node as a child of a specified parent node.
|
void |
removeAllChildren()
Remove all children of the node.
|
BaseNode |
removeChild(BaseNode oldChild)
Removes a child node from the current element, which must be a child of the current node.
|
void |
setNodeValue(String nodeValue)
Sets the value of the current node.
|
void |
setTextContent(String textContent)
Sets the textual content of an element and all its descendants.
|
addEventListener, removeEventListener
@JsProperty public final NodeList<BaseNode> getChildNodes()
@JsProperty public final BaseNode getFirstChild()
null
if the node has no child.null
if the node has no child@JsProperty public final BaseNode getLastChild()
null
if the node has no child.null
if the node has no child@JsProperty public final BaseNode getNextSibling()
null
if there isn't such node.null
if there isn't such node@JsProperty public final String getNodeName()
@JsOverlay public final NodeType getNodeType()
@JsProperty public final String getNodeValue()
@JsProperty public final void setNodeValue(String nodeValue)
nodeValue
- the value of the current node@JsProperty public final BaseDocument getOwnerDocument()
null
.@JsProperty public final BaseNode getParentNode()
null
.@JsProperty public BaseElement getParentElement()
null
.@JsProperty public final BaseNode getPreviousSibling()
null
if there isn't such node.null
if there isn't such node@JsProperty public final String getTextContent()
@JsProperty public final void setTextContent(String textContent)
textContent
- the textual content of an element and all its descendants@JsMethod public final BaseNode appendChild(BaseNode newChild)
newChild
- the node to append to the given parent node (commonly an element)@JsMethod public final BaseNode cloneNode(boolean deep)
deep
- If true
, then node and its whole subtree including text.false
, only node will be cloned.@JsMethod public final boolean hasChildNodes()
@JsMethod public final BaseNode insertBefore(BaseNode newChild, BaseNode refChild)
newChild
- the node to be inserted.refChild
- the node before which new node is inserted.null
, then new node is inserted at the end of child nodes.@JsMethod public final BaseNode removeChild(BaseNode oldChild)
oldChild
- is the child node to be removed from the DOM.@JsOverlay public final void removeAllChildren()