From W3C Wiki
< DOM‎ | domcore
Jump to: navigation, search


The Node interface is the primary datatype for the entire DOM. It represents a single node in the document tree. While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children. For example, Text nodes may not have children, and adding children to such nodes results in a DOMException being raised.


Name Description
nodeType Returns the type of this node.
nodeName Returns the name of this node.
baseURI Returns the absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.
ownerDocument Returns the top level document object for this node.
parentNode Returns the parent of this node in the DOM tree.
parentElement Returns the parent element of this node in the DOM tree.
childNodes Returns the child of this node in the DOM tree.
firstChild Returns the first child of this node in the DOM tree.
lastChild Returns the last child of this node in the DOM tree.
previousSibling Returns the node immediately preceding this node.
nextSibling Returns the node immediately following this node..
nodeValue Returns the value of this node.
textContent Returns this attribute returns the text content of this node and its descendants.


Name Description
hasChildNodes() Returns whether this node has any children.
compareDocumentPosition(other) ...
insertBefore(newChild, refChild) Inserts the node newChild before the existing child node refChild.
replaceChild(newChild, oldChild) Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
removeChild(oldChild) Removes the child node indicated by oldChild from the list of children, and returns it.
appendChild(newChild) Adds the node newChild to the end of the list of children of this node.
cloneNode(deep) ...
isSameNode(node) Returns whether this node is the same node as the given one.
lookupPrefix(namespace) Look up the prefix associated to the given namespace URI, starting from this node.
lookupNamespaceURI(prefix) Look up the namespace URI associated to the given prefix, starting from this node.
isDefaultNamespace(namespace) Checks if the specified namespaceURI is the default namespace or not.

DOM Core reference

DOM Core specification defines the Interface Node in 5.3 Interface Node.