MutationRecord
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TheMutationRecord is a read-only interface that represents an individual DOM mutation observed by aMutationObserver. It is the object inside the array passed to the callback of aMutationObserver.
In this article
Instance properties
MutationRecord.addedNodesRead onlyThe nodes added by a mutation. Will be an empty
NodeListif no nodes were added.MutationRecord.attributeNameRead onlyThe name of the changed attribute as a string, or
null.MutationRecord.attributeNamespaceRead onlyThe namespace of the changed attribute as a string, or
null.MutationRecord.nextSiblingRead onlyThe next sibling of the added or removed nodes, or
null.MutationRecord.oldValueRead onlyThe value depends on the
MutationRecord.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 isnull.
- For
MutationRecord.previousSiblingRead onlyThe previous sibling of the added or removed nodes, or
null.MutationRecord.removedNodesRead onlyThe nodes removed by a mutation. Will be an empty
NodeListif no nodes were removed.MutationRecord.targetRead onlyThe node the mutation affected, depending on the
MutationRecord.type.- For
attributes, it is the element whose attribute changed. - For
characterData, it is theCharacterDatanode. - For
childList, it is the node whose children changed.
- For
MutationRecord.typeRead onlyA string representing the type of mutation:
attributesif the mutation was an attribute mutation,characterDataif it was a mutation to aCharacterDatanode, andchildListif it was a mutation to the tree of nodes.
Specifications
| Specification |
|---|
| DOM> # interface-mutationrecord> |