JavaScripture
Contribute via GitHub Feedback

MutationRecord : Object

MutationRecord contains information about a mutation that was observed by MutationObserver.

Instance Properties

addedNodes : NodeList  

Contains the nodes added to target. Only applies when type is 'childList'.

Example:

Run

Results:

 

attributeName : String  

The name of the attribute that changed. Only applies when type is 'attributes'. See also attributeNamespace.

Example:

Run

Results:

 

attributeNamespace : String  

The namespace of the attribute that changed. Only applies when type is 'attributes'. See also attributeName.

nextSibling : Node  

The Node after the removed node. See also previousSibling.

Example:

Run

Results:

 

oldValue : String  

The previous value of the attribute or data. Only applies when type is 'attributes' or 'characterData'. You must specify the attributeOldValue or characterDataOldValue option to MutationObserver.observe() for the oldValue to be recorded.

Example:

Run

Results:

 

previousSibling : Node  

The Node before the removed node. See also nextSibling.

Example:

Run

Results:

 

removedNodes : NodeList  

Contains the nodes added to target. Only applies when type is 'childList'.

Example:

Run

Results:

 

target : Node  

The Node that the mutation happened on. If the subtree option was specified when calling MutationObserver.observe() this may be a descendant of the target passed to observe().

Example:

Run

Results:

 

type : String  

The type of mutation. Will be one of 'attributes', 'childList', or 'characterData'.

It will be 'attributes' if an Element.attribute changed. To receive attribute changes, the options passed to observe() must have attributes set to true, attributesOldValue set to true, or attributeFilter set to an array of attribute names.

It will be 'childList' if the Node.childNodes changed. To receive childList changes, the options passed to observe() must have childList set to true.

It will be 'characterData' if the CharacterData.data changed. To receive characterData changes, the options passed to observe() must have characterData set to true.

Set the subtree option to true in the call to observe() to receive any of these changes on nodes in the subtree.

Example:

Run

Results: