Node
Module: JavaScript DOM API
The basic document node.
#include <Node.idl>
Inherits from EventTarget
Inherited by Attr, CharacterData, Document, DocumentFragment, DocumentType, Element
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| Node | removeChild(Node oldChild) remove a child node |
| Node | appendChild(Node newChild) append a node as a child |
| void | append((Node or DOMString)… newChildren) append nodes and string objects as children, where the string objects are inserted as equivalent Text nodes |
| Node | replaceChild(Node newChild, Node oldChild) replace oldChild with newChild |
| Node | insertBefore(Node node, Node? referenceNode) insert a node before the reference node, as a child of the current node |
| Node | cloneNode(optional boolean deep =false) |
| boolean | isEqualNode(Node? otherNode) |
| boolean | isSameNode(Node? otherNode) |
| boolean | hasChildNodes() |
| boolean | contains(Node? other) |
| DOMString | lookupPrefix(DOMString? namespace) |
| boolean | isDefaultNamespace(DOMString? namespace) |
| void | normalize() |
| unsigned short | compareDocumentPosition(Node other) |
| Node | getRootNode(optional GetRootNodeOptions options) |
| DOMString | lookupNamespaceURI(DOMString? prefix) |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| const unsigned short | ELEMENT_NODE |
| const unsigned short | ATTRIBUTE_NODE |
| const unsigned short | TEXT_NODE |
| const unsigned short | CDATA_SECTION_NODE |
| const unsigned short | ENTITY_REFERENCE_NODE |
| const unsigned short | ENTITY_NODE |
| const unsigned short | PROCESSING_INSTRUCTION_NODE |
| const unsigned short | COMMENT_NODE |
| const unsigned short | DOCUMENT_NODE |
| const unsigned short | DOCUMENT_TYPE_NODE |
| const unsigned short | DOCUMENT_FRAGMENT_NODE |
| const unsigned short | NOTATION_NODE |
| const unsigned short | DOCUMENT_POSITION_DISCONNECTED |
| const unsigned short | DOCUMENT_POSITION_PRECEDING |
| const unsigned short | DOCUMENT_POSITION_FOLLOWING |
| const unsigned short | DOCUMENT_POSITION_CONTAINS |
| const unsigned short | DOCUMENT_POSITION_CONTAINED_BY |
| const unsigned short | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC |
| readonly attribute DOMString | nodeName |
| attribute DOMString | nodeValue |
| attribute DOMString | textContent |
| readonly attribute unsigned short | nodeType type of the node |
| readonly attribute Node | parentNode parent of the node |
| readonly attribute Element | parentElement parent element of the node. If parent is not an Element, returns null. |
| readonly attribute NodeList | childNodes list of the children of this node |
| readonly attribute Node | firstChild the node’s first child in the tree, or null if the node is childless |
| readonly attribute Node | lastChild last child of the node, or null if there are no child elements |
| readonly attribute Node | previousSibling the node immediately preceding the specified one in its parent’s children, or null if the specified node is the first in that list |
| readonly attribute Node | nextSibling the node immediately following the specified one in its parent’s children, or null if the specified node is the last node in that list |
| readonly attribute Document | ownerDocument The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null. |
| readonly attribute USVString | baseURI |
| readonly attribute boolean | isConnected |
| attribute EventSetter | slotchange |
Additional inherited members
Section titled “Additional inherited members”Public Functions inherited from EventTarget
| Name | |
|---|---|
| void | addEventListener(DOMInternedString type, EventListener listener, optional AddEventListenerOptions options) |
| void | removeEventListener(DOMInternedString type, EventListener listener, optional RemoveEventListenerOptions options) |
| boolean | dispatchEvent(Event event) |
Public Functions Documentation
Section titled “Public Functions Documentation”function removeChild
Section titled “function removeChild”Node removeChild( Node oldChild)remove a child node
Parameters:
- oldChild the child node to be removed
Return: the removed child node
function appendChild
Section titled “function appendChild”Node appendChild( Node newChild)append a node as a child
Parameters:
- newChild the node to append
Return: the appended child node
function append
Section titled “function append”void append( (Node or DOMString)... newChildren)append nodes and string objects as children, where the string objects are inserted as equivalent Text nodes
Parameters:
- newChildren the nodes or strings to append
function replaceChild
Section titled “function replaceChild”Node replaceChild( Node newChild, Node oldChild)replace oldChild with newChild
Return: the replaced child node
function insertBefore
Section titled “function insertBefore”Node insertBefore( Node node, Node? referenceNode)insert a node before the reference node, as a child of the current node
Parameters:
- node the new node to be inserted
- referenceNode the reference node (if null, node will be inserted at the end of the child nodes list)
Return: the inserted node
function cloneNode
Section titled “function cloneNode”Node cloneNode( optional boolean deep =false)Return: a clone of the node
function isEqualNode
Section titled “function isEqualNode”boolean isEqualNode( Node? otherNode)function isSameNode
Section titled “function isSameNode”boolean isSameNode( Node? otherNode)function hasChildNodes
Section titled “function hasChildNodes”boolean hasChildNodes()function contains
Section titled “function contains”boolean contains( Node? other)function lookupPrefix
Section titled “function lookupPrefix”DOMString lookupPrefix( DOMString? namespace)function isDefaultNamespace
Section titled “function isDefaultNamespace”boolean isDefaultNamespace( DOMString? namespace)function normalize
Section titled “function normalize”void normalize()function compareDocumentPosition
Section titled “function compareDocumentPosition”unsigned short compareDocumentPosition( Node other)function getRootNode
Section titled “function getRootNode”Node getRootNode( optional GetRootNodeOptions options)function lookupNamespaceURI
Section titled “function lookupNamespaceURI”DOMString lookupNamespaceURI( DOMString? prefix)Public Attributes Documentation
Section titled “Public Attributes Documentation”variable ELEMENT_NODE
Section titled “variable ELEMENT_NODE”const unsigned short ELEMENT_NODE = 1;variable ATTRIBUTE_NODE
Section titled “variable ATTRIBUTE_NODE”const unsigned short ATTRIBUTE_NODE = 2;variable TEXT_NODE
Section titled “variable TEXT_NODE”const unsigned short TEXT_NODE = 3;variable CDATA_SECTION_NODE
Section titled “variable CDATA_SECTION_NODE”const unsigned short CDATA_SECTION_NODE = 4;variable ENTITY_REFERENCE_NODE
Section titled “variable ENTITY_REFERENCE_NODE”const unsigned short ENTITY_REFERENCE_NODE = 5;variable ENTITY_NODE
Section titled “variable ENTITY_NODE”const unsigned short ENTITY_NODE = 6;variable PROCESSING_INSTRUCTION_NODE
Section titled “variable PROCESSING_INSTRUCTION_NODE”const unsigned short PROCESSING_INSTRUCTION_NODE = 7;variable COMMENT_NODE
Section titled “variable COMMENT_NODE”const unsigned short COMMENT_NODE = 8;variable DOCUMENT_NODE
Section titled “variable DOCUMENT_NODE”const unsigned short DOCUMENT_NODE = 9;variable DOCUMENT_TYPE_NODE
Section titled “variable DOCUMENT_TYPE_NODE”const unsigned short DOCUMENT_TYPE_NODE = 10;variable DOCUMENT_FRAGMENT_NODE
Section titled “variable DOCUMENT_FRAGMENT_NODE”const unsigned short DOCUMENT_FRAGMENT_NODE = 11;variable NOTATION_NODE
Section titled “variable NOTATION_NODE”const unsigned short NOTATION_NODE = 12;variable DOCUMENT_POSITION_DISCONNECTED
Section titled “variable DOCUMENT_POSITION_DISCONNECTED”const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;variable DOCUMENT_POSITION_PRECEDING
Section titled “variable DOCUMENT_POSITION_PRECEDING”const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;variable DOCUMENT_POSITION_FOLLOWING
Section titled “variable DOCUMENT_POSITION_FOLLOWING”const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;variable DOCUMENT_POSITION_CONTAINS
Section titled “variable DOCUMENT_POSITION_CONTAINS”const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;variable DOCUMENT_POSITION_CONTAINED_BY
Section titled “variable DOCUMENT_POSITION_CONTAINED_BY”const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;variable DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
Section titled “variable DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC”const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;variable nodeName
Section titled “variable nodeName”readonly attribute DOMString nodeName;variable nodeValue
Section titled “variable nodeValue”attribute DOMString nodeValue;variable textContent
Section titled “variable textContent”attribute DOMString textContent;variable nodeType
Section titled “variable nodeType”readonly attribute unsigned short nodeType;type of the node
variable parentNode
Section titled “variable parentNode”readonly attribute Node parentNode;parent of the node
variable parentElement
Section titled “variable parentElement”readonly attribute Element parentElement;parent element of the node. If parent is not an Element, returns null.
variable childNodes
Section titled “variable childNodes”readonly attribute NodeList childNodes;list of the children of this node
variable firstChild
Section titled “variable firstChild”readonly attribute Node firstChild;the node’s first child in the tree, or null if the node is childless
variable lastChild
Section titled “variable lastChild”readonly attribute Node lastChild;last child of the node, or null if there are no child elements
variable previousSibling
Section titled “variable previousSibling”readonly attribute Node previousSibling;the node immediately preceding the specified one in its parent’s children, or null if the specified node is the first in that list
variable nextSibling
Section titled “variable nextSibling”readonly attribute Node nextSibling;the node immediately following the specified one in its parent’s children, or null if the specified node is the last node in that list
variable ownerDocument
Section titled “variable ownerDocument”readonly attribute Document ownerDocument;The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null.
variable baseURI
Section titled “variable baseURI”readonly attribute USVString baseURI;variable isConnected
Section titled “variable isConnected”readonly attribute boolean isConnected;variable slotchange
Section titled “variable slotchange”attribute EventSetter slotchange;© 2026 Coherent Labs. All rights reserved.