The MutationObserverInit
dictionary describes the configuration of a mutation observer. As such, it's primarily used as the type of the options
parameter on the MutationObserver.observe()
method.
At a minimum, one of childList
, attributes
, and/or characterData
must be true
when you call observe()
. Otherwise, a TypeError
exception will be thrown.
attributeFilter
Optional
attributeOldValue
Optional
true
to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes; see Monitoring attribute values in MutationObserver for details on watching for attribute changes and value recording. No default value.attributes
Optional
true
to watch for changes to the value of attributes on the node or nodes being monitored. The default value is false
.characterData
Optional
true
to monitor the specified target node or subtree for changes to the character data contained within the node or nodes. No default value.characterDataOldValue
Optional
true
to record the previous value of a node's text whenever the text changes on nodes being monitored. For details and an example, see Monitoring text content changes in MutationObserver. No default value.childList
Optional
true
to monitor the target node (and, if subtree
is true
, its descendants) for the addition or removal of new child nodes. The default is false
.subtree
Optional
true
to extend monitoring to the entire subtree of nodes rooted at target
. All of the other MutationObserverInit
properties are then extended to all of the nodes in the subtree instead of applying solely to the target
node. The default value is false
.Specification | Status | Comment |
---|---|---|
DOM The definition of 'MutationObserverInit' in that specification. | Living Standard |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 26
|
Yes | 14 | 11 | 15 | 7
|
attributeFilter |
26
|
Yes | 14 | 11 | 15 | 7
|
attributeOldValue |
26
|
Yes | 14
|
11 | 15 | 7
|
attributes |
26
|
Yes | 14
|
11 | 15 | 7
|
characterData |
26
|
Yes | 14
|
11 | 15 | 7
|
characterDataOldValue |
26
|
Yes | 14
|
11 | 15 | 7
|
childList |
26
|
Yes | 14 | 11 | 15 | 7
|
subtree |
26
|
Yes | 14 | 11 | 15 | 7
|
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | 26
|
? | 14 | 15 | 7
|
? |
attributeFilter |
? | 26
|
? | 14 | 15 | 7
|
? |
attributeOldValue |
? | 26
|
? | 14
|
15 | 7
|
? |
attributes |
? | 26
|
? | 14
|
15 | 7
|
? |
characterData |
? | 26
|
? | 14
|
15 | 7
|
? |
characterDataOldValue |
? | 26
|
? | 14
|
15 | 7
|
? |
childList |
? | 26
|
? | 14 | 15 | 7
|
? |
subtree |
? | 26
|
? | 14 | 15 | 7
|
? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserverInit