DOM
Source[Exposed=Window]
interface MutationRecord
{ readonly attribute DOMString type; [SameObject] readonly attribute Node target; [SameObject] readonly attribute NodeList addedNodes; [SameObject] readonly attribute NodeList removedNodes; readonly attribute Node? previousSibling; readonly attribute Node? nextSibling; readonly attribute DOMString? attributeName; readonly attribute DOMString? attributeNamespace; readonly attribute DOMString? oldValue;
};
record . type
Returns "attributes
" if it was an attribute mutation. "characterData
" if it was a mutation to a CharacterData
node. And "childList
" if it was a mutation to the tree of nodes. record . target
Returns the node the mutation affected, depending on the type
. For "attributes
", it is the element whose attribute changed. For "characterData
", it is the CharacterData
node. For "childList
", it is the node whose children changed. record . addedNodes
record . removedNodes
Return the nodes added and removed respectively. record . previousSibling
record . nextSibling
Return the previous and next sibling respectively of the added or removed nodes; otherwise null. record . attributeName
Returns the local name of the changed attribute; otherwise null. record . attributeNamespace
Returns the namespace of the changed attribute; otherwise null. record . oldValue
The return value depends on type
. For "attributes
", it is the value of the changed attribute before the change. For "characterData
", it is the data of the changed node before the change. For "childList
", it is null. The type
, target
, addedNodes
, , previousSibling
, nextSibling
, attributeName
, attributeNamespace
, and oldValue
attributes must return the values they were
initialized to.
Nodes have a strong reference to registered observers in their registered observer list.
Registered observers in a node’s registered observer list have a weak
reference to the node.
In all current engines.
Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+
[Exposed=Window] interfaceNode
: = 5; // legacy const = 6; // legacy const = 12; // legacy readonly attribute = {}); readonly attribute = false); ); ); // legacy alias of === const ); ); ); ); ); [, ); [); [, ); [CEReactions] Node removeChild(Node ); }; dictionaryGetRootNodeOptions
{ booleancomposed
= false; };
Node
is an abstract interface and does not exist as node. It
is used by all nodes (Document
, DocumentType
, DocumentFragment
, Element
, Text
, ProcessingInstruction
, and Comment
).
Each node has an associated node document, set upon creation, that is a document.
A node’s node document can be changed by the adopt algorithm.
A node’s get the parent algorithm, given an event, returns the node’s assigned slot, if node is assigned; otherwise node’s parent.
Each node also has a registered observer list.
node . nodeType
Returns the type of node, represented by a number from the following list: Node
. ELEMENT_NODE
(1) node is an element. Node
. TEXT_NODE
(3) node is a Text
node. Node
. CDATA_SECTION_NODE
(4) node is a CDATASection
node. Node
. PROCESSING_INSTRUCTION_NODE
(7) node is a ProcessingInstruction
node. Node
. COMMENT_NODE
(8) node is a Comment
node. Node
. DOCUMENT_NODE
(9) node is a document. Node
. DOCUMENT_TYPE_NODE
(10) node is a doctype. Node
. DOCUMENT_FRAGMENT_NODE
(11) node is a DocumentFragment
node. node . nodeName