W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: Should MutationObservers be able to observe work done by the HTML parser?

From: Adam Klein <adamk@chromium.org>
Date: Fri, 29 Jun 2012 11:25:25 -0700
Message-ID: <CAEvLGcLGN=s8N2Tk5xcM=a2wLcrS6W8vTnK=axfjTq2GScSSkQ@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: olli@pettay.fi, Anne van Kesteren <annevk@annevk.nl>, Ian Hickson <ian@hixie.ch>, WebApps WG <public-webapps@w3.org>
On Fri, Jun 29, 2012 at 2:44 AM, Jonas Sicking <jonas@sicking.cc> wrote:

> All in all I think that as soon as we introduce exceptions to when
> MutationObserver callbacks fire we change the API from being a
> reliable way to track DOM mutations to a unreliable way where all
> callers have to be aware of exceptions and deal with them in other
> ways. I.e. it feels like it significantly reduces the value of
> MutationObservers.
> And so far I don't see any good arguments made for making that
> reduction in value. Did I miss any arguments other then the randomness
> argument?

Performance was one concern that's come up in discussing this with Ojan and
Rafael. Imagine a MutationObserver attached to the document near the top of
the page. Now we need to create basically one MutationRecord per node
inserted (because the parser operates in a depth-first sort of order). I'm
not at all sure this is a show-stopper (we might be able to introduce some
new MutationRecord type that could compactly represent parser-style
operation), but it definitely seems worrisome, especially given that one of
the common uses for MutationObservers is extensions which might run on many
(all?) pages.

- Adam
Received on Friday, 29 June 2012 18:25:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:34 UTC