[whatwg] Mutation Observer arguments format

Alex Russell slightlyoff at google.com
Mon Mar 11 17:41:30 PDT 2013


Hi all,

I had a moment today while trying to use Mutation Observers where it wasn't
clear to me what bits of the configuration passed to observe() are required
and which are configuration about required values. In particular, the names
"subtree" and "childList" feel like they should be peers, but it seems
they're not.

After a quick chat with Adam Klein, it seems like it might be easier to
understand if the "childList", "attributes", and "characterData" attributes
of the configuration bag were rolled into a single value, e.g. "type" or
"types". The observe() might then be written as:

    observer.observe(node, { types: ["attributes", "childList"], subtree:
true });

This breaks the types of observation into a separate bag from the
configuration for those observations.

Thoughts?


More information about the whatwg mailing list