-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Mutation observer project
Josh Matthews edited this page Feb 15, 2017
·
3 revisions
Background information: The DOM standard defines a MutationObserver API that allows web content to receive callbacks when the page contents are mutated. The goal of this work is to implement the fundamental pieces required to support this API.
Tracking issue: https://github.com/servo/servo/issues/6633 (please ask questions here)
Initial steps:
- email the mozilla.dev.servo mailing list (be sure to subscribe to it first!) introducing your group and asking any necessary questions
-
create the MutationObserver and MutationRecord interfaces with stub method implementations
- hide the new interfaces by default by adding a
[Pref="dom.mutation_observer.enabled"]
attribute to each one and add a corresponding preference toresources/prefs.json
- hide the new interfaces by default by adding a
- add a
__dir__.ini
file totests/wpt/metadata/dom/nodes/
which enables the new preference, then run the tests in that directory and update the expected test results. - add a vector of
MutationObserver
objects as a member of ScriptThread - implement the
MutationObserver
constructor
Subsequent steps:
- add support for mutation observer microtasks
- add a
mutation_observer_compound_microtask_queued
member toScriptThread
- implement the queue a mutation observer compound microtask algorithm by adding a new variant to the Microtask enum for mutation observers
- implement the notify mutation observers algorithm (ignoring the specific text about "execute a compound microtask") using the vector of observers previously added to ScriptThread
- add a
- add support for observing specific mutations
- add a vector of
MutationObserver
objects to Node - implement MutationObserver.observe (step 7 and 8 mean "replace an existing matching entry with the new options, or add a new entry if there is no match")
- implement the queue a mutation record algorithm
- make changing/appending/removing/replacing an attribute queue a mutation record via Attr::set_value, Element::push_attribute, and Element::remove_first_matching_attribute
- add a vector of