The MutationRecord is a read-only interface that represents an individual DOM mutation observed by a MutationObserver. It is the object inside the array passed to the callback of a MutationObserver.
On this page
MutationRecord
Instance properties
MutationRecord.addedNodesRead only-
The nodes added by a mutation. Will be an empty
NodeListif no nodes were added. MutationRecord.attributeNameRead only-
The name of the changed attribute as a string, or
null. MutationRecord.attributeNamespaceRead only-
The namespace of the changed attribute as a string, or
null. MutationRecord.nextSiblingRead only-
The next sibling of the added or removed nodes, or
null. MutationRecord.oldValueRead only-
The 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 only-
The previous sibling of the added or removed nodes, or
null. MutationRecord.removedNodesRead only-
The nodes removed by a mutation. Will be an empty
NodeListif no nodes were removed. MutationRecord.targetRead only-
The 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 only-
A 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 Standard # interface-mutationrecord |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
MutationRecord |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
addedNodes |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
attributeName |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
attributeNamespace |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
nextSibling |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
oldValue |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
previousSibling |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
removedNodes |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
target |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
type |
16 | 12 | 14 | 11 | 15 | 7 | 4.4 | 18 | 14 | 14 | 7 | 1.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord