DOM

DOM

Source

MutationObserver/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:

MutationObserver/observe

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:

  1. If either options["attributeOldValue"] or options["attributeFilter"] exists, and options["attributes"] does not exist, then set options["attributes"] to true.

  2. If options["characterDataOldValue"] exists and options["characterData"] does not exist, then set options["characterData"] to true.

  3. If none of options["childList"], options["attributes"], and options["characterData"] is true, then throw a TypeError.

  4. If options["attributeOldValue"] is true and options["attributes"] is false, then throw a TypeError.

  5. If options["attributeFilter"] is present and options["attributes"] is false, then throw a TypeError.

  6. If options["characterDataOldValue"] is true and options["characterData"] is false, then throw a TypeError.

  7. For each registered of target’s registered observer list, if registered’s observer is this:

  8. Otherwise:

MutationObserver/disconnect

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:

MutationObserver/takeRecords

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:

  1. Let interestedObservers be an empty map.

  2. Let nodes be the inclusive ancestors of target.

  3. For each node in nodes, and then for each registered of node’s registered observer list:

    1. Let options be registered’s options.

    2. If none of the following are true

      then:

      1. Let mo be registered’s observer.

      2. If interestedObservers[mo] does not exist, then set interestedObservers[mo] to null.

      3. 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.

  4. For each observer → mappedOldValue of interestedObservers:

  5. Queue a mutation observer microtask.

To queue a tree mutation record for target with addedNodes, removedNodes, previousSibling, and nextSibling, run these steps:

  1. Assert: either addedNodes or removedNodes is not empty.

  2. Queue a mutation record of "childList" for target with null, null, null, addedNodes, removedNodes, previousSibling, and nextSibling.

MutationRecord

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

Report Page