W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

[whatwg] Mutation Observer arguments format

From: Alex Russell <slightlyoff@google.com>
Date: Tue, 12 Mar 2013 00:41:30 +0000
Message-ID: <CANr5HFWsetub=tJHn0k2zgaXO4meCpKRJ65Gq=TEmX5YOaEG6w@mail.gmail.com>
To: whatwg <whatwg@lists.whatwg.org>
Cc: Adam Klein <adamk@google.com>, Jonas Sicking <sicking@mozilla.com>, "Olli@pettay.fi" <Olli@pettay.fi>, Rafael Weinstein <rafaelw@google.com>
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?
Received on Tuesday, 12 March 2013 00:41:56 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 12 March 2013 00:41:56 GMT