DOM
SourceMutationObserver/MutationObserver
In all current engines.
Firefox14+Safari7+Chrome26+ Opera15+Edge79+ Edge (Legacy)12+IE11 Firefox for Android14+iOS Safari7+Chrome for Android26+Android WebView37+Samsung Internet1.5+Opera Mobile14+
The new MutationObserver(callback)
constructor steps are:
In all current engines.
Firefox14+Safari6+Chrome18+ Opera15+Edge79+ Edge (Legacy)12+IE11 Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+
The observe(target, options)
method steps are:
-
If either options["
attributeOldValue
"] or options["attributeFilter
"] exists, and options["attributes
"] does not exist, then set options["attributes
"] to true. -
If options["
characterDataOldValue
"] exists and options["characterData
"] does not exist, then set options["characterData
"] to true. -
If none of options["
childList
"], options["attributes
"], and options["characterData
"] is true, then throw aTypeError
. -
If options["
attributeOldValue
"] is true and options["attributes
"] is false, then throw aTypeError
. -
If options["
attributeFilter
"] is present and options["attributes
"] is false, then throw aTypeError
. -
If options["
characterDataOldValue
"] is true and options["characterData
"] is false, then throw aTypeError
. -
For each registered of target’s registered observer list, if registered’s observer is this:
-
Otherwise:
In all current engines.
Firefox14+Safari6+Chrome18+ Opera15+Edge79+ Edge (Legacy)12+IE11 Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+
The disconnect()
method steps are:
In all current engines.
Firefox14+Safari6+Chrome18+ Opera15+Edge79+ Edge (Legacy)12+IE11 Firefox for Android14+iOS Safari6+Chrome for Android18+Android WebView37+Samsung Internet1.0+Opera Mobile14+
The takeRecords()
method steps are:
To queue a mutation record of type for target with name, namespace, oldValue, addedNodes, removedNodes, previousSibling, and nextSibling, run these steps:
-
Let interestedObservers be an empty map.
-
Let nodes be the inclusive ancestors of target.
-
For each node in nodes, and then for each registered of node’s registered observer list:
-
Let options be registered’s options.
-
If none of the following are true
then:
-
Let mo be registered’s observer.
-
If interestedObservers[mo] does not exist, then set interestedObservers[mo] to null.
-
If either type is "
attributes
" and options["attributeOldValue
"] is true, or type is "characterData
" and options["characterDataOldValue
"] is true, then set interestedObservers[mo] to oldValue.
-
-
-
For each observer → mappedOldValue of interestedObservers:
To queue a tree mutation record for target with addedNodes, removedNodes, previousSibling, and nextSibling, run these steps:
-
Assert: either addedNodes or removedNodes is not empty.
-
Queue a mutation record of "
childList
" for target with null, null, null, addedNodes, removedNodes, previousSibling, and nextSibling.
In all current engines.
Firefox14+Safari6.1+ChromeYes OperaYesEdgeYes Edge (Legacy)12+IE11 Firefox for Android14+iOS Safari7+Chrome for AndroidYesAndroid WebViewYesSamsung InternetYesOpera MobileYes
Read Next page