Node in DOM Level 2 Core

The Node interface represents a single node in the document tree.

For more information see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247.

Inherits from:

Inerhited by:

Instance Properties

name type description
attributes NamedNodeMap (read only)
childNodes NodeList (read only)
firstChild Node (read only)
lastChild Node (read only)
localName String (read only)
namespaceURI String (read only)
nextSibling Node (read only)
nodeName String (read only)
nodeType Number (read only)
nodeValue String
ownerDocument Document (read only)
parentNode Node (read only)
prefix String
previousSibling Node (read only)

Instance Methods

name returns description
addEventListener(type,listener,useCapture) (none) [from EventTarget]
appendChild(newChild) Node
cloneNode(deep) Node Return a new copy of the node.
dispatchEvent(evt) Boolean Dispatches an event to the invoking object. [from EventTarget]
hasAttributes() Boolean
hasChildNodes() Boolean
insertBefore(newChild,refChild) Node
isSupported(feature,version) Boolean
normalize() (none)
removeChild(oldChild) Node
removeEventListener(type,listener,useCapture) (none) [from EventTarget]
replaceChild(newChild,oldChild) Node

Constants

name object value description
ELEMENT_NODE Node 1
ATTRIBUTE_NODE Node 2
TEXT_NODE Node 3
CDATA_SECTION_NODE Node 4
ENTITY_REFERENCE_NODE Node 5
ENTITY_NODE Node 6
PROCESSING_INSTRUCTION_NODE Node 7
COMMENT_NODE Node 8
DOCUMENT_NODE Node 9
DOCUMENT_TYPE_NODE Node 10
DOCUMENT_FRAGMENT_NODE Node 11
NOTATION_NODE Node 12

Description

The Node interface is the primary datatype for the entire Document Object Model. 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.

The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue for an Element or attributes for a Comment), this returns null. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

Properties that are a Node

name object description
firstChild Node (read only)
lastChild Node (read only)
nextSibling Node (read only)
ownerNode [stylesheets] StyleSheet (read only)
parentNode Node (read only)
previousSibling Node (read only)
relatedNode [events] MutationEvent (read only)

Methods that return a Node

name of object description
appendChild(newChild) Node
cloneNode(deep) Node Return a new copy of the node.
getNamedItem(name) NamedNodeMap
getNamedItemNS(namespaceURI,localName) NamedNodeMap
importNode(importedNode,deep) Document Imports a node from another document to this document.
insertBefore(newChild,refChild) Node
item(index) HTMLOptionsCollection
item(index) NodeList
item(index) HTMLCollection
item(index) NamedNodeMap
namedItem(name) HTMLOptionsCollection
namedItem(name) HTMLCollection
removeChild(oldChild) Node
removeNamedItem(name) NamedNodeMap
removeNamedItemNS(namespaceURI,localName) NamedNodeMap
replaceChild(newChild,oldChild) Node
setNamedItem(arg) NamedNodeMap
setNamedItemNS(arg) NamedNodeMap

Arguments that are a Node

name in method of object description
arg setNamedItem(arg) NamedNodeMap
arg setNamedItemNS(arg) NamedNodeMap
importedNode importNode(importedNode,deep) Document The node to import.
newChild appendChild(newChild) Node
newChild replaceChild(newChild,oldChild) Node
newChild insertBefore(newChild,refChild) Node
oldChild removeChild(oldChild) Node
oldChild replaceChild(newChild,oldChild) Node
refChild insertBefore(newChild,refChild) Node
relatedNodeArg initMutationEvent(typeArg,canBubbleArg,cancelableArg,…) [events] MutationEvent