DOM node (source code)

= DOM node
{c}

A <DOM node> is an object participating in the node model of the <Document Object Model>. Documents, <DOM elements>, <DOM text nodes>, <DOM comment nodes> and <DOM document fragments> are different node kinds. They share operations and relationships defined by the Node interface, while particular kinds expose additional data and constraints.<DOM Standard by WHATWG>[Node interface and node tree definitions]{ref}

For example, a paragraph element can contain a text node. The paragraph has a tag name and attributes; its text child stores character data. Both are <DOM nodes>, but an element-specific operation such as setting an attribute is not thereby available on the text node.

Insertion also concerns object identity. Suppose an existing paragraph is a child of element A. Executing `B.appendChild(paragraph)` moves that same node under B, removing it from A's child list. It does not automatically make a second paragraph. Cloning is a separate operation, with its own treatment of descendants.<DOM Standard by WHATWG>[Node.appendChild, insertion algorithms and Node.cloneNode]{ref}

A newly created node can exist without being connected to a displayed document. Conversely, a connected node need not produce a visible box: a <CSS declaration> can suppress its display. A reference to a node therefore identifies a document-model object, not a promise about visibility or a fixed screen position. Reading the node kind and its current tree relationships is the appropriate starting point for manipulation.