MutationRecord

A MutationRecord represents an individual DOM mutation. It is the object that is passed to MutationObserver's callback.

Properties

Property Type Description
MutationRecord.type String Returns "attributes" if the mutation 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.
MutationRecord.target Node Returns the node the mutation affected, depending on the MutationRecord.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.
MutationRecord.addedNodes NodeList Return the nodes added. Will be an empty NodeList if no nodes were added.
MutationRecord.removedNodes NodeList Return the nodes removed. Will be an empty NodeList if no nodes were removed.
MutationRecord.previousSibling Node Return the previous sibling of the added or removed nodes, or null.
MutationRecord.nextSibling Node Return the next sibling of the added or removed nodes, or null.
MutationRecord.attributeName String Returns the local name of the changed attribute, or null.
MutationRecord.attributeNamespace String Returns the namespace of the changed attribute, or null.
MutationRecord.oldValue String

The return 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 is null.

Note that for this to work as expected, attributeOldValue or characterDataOldValue must be set to true in the corresponding MutationObserverInit parameter of the MutationObserver observe method

Specifications

Specification Status Comment
DOM
The definition of 'MutationRecord' in that specification.
Living Standard

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
MutationRecordChrome Full support YesEdge Full support ≤18Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
addedNodesChrome Full support YesEdge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
attributeNameChrome Full support YesEdge Full support ≤18Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
attributeNamespaceChrome Full support YesEdge Full support ≤18Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
nextSiblingChrome Full support YesEdge Full support ≤18Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
oldValueChrome Full support YesEdge Full support ≤18Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
previousSiblingChrome Full support YesEdge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
removedNodesChrome Full support YesEdge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
targetChrome Full support YesEdge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
typeChrome Full support YesEdge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support
Compatibility unknown
Compatibility unknown