W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: [webcomponents]: What callbacks do custom elements need?

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 12 Mar 2013 01:42:53 -0700
Message-ID: <CA+c2ei953jEjnu_n2poWUfh6Ns0s13mbrwDnrVKQY+5DP-rdSg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: public-webapps@w3.org
On Mon, Mar 11, 2013 at 5:45 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 3/11/13 5:18 PM, Elliott Sprehn wrote:
>>
>> "inserted" and "removed" can probably be end of micro task, but
>> attributeChanged definitely needs to be synchronous to model the
>> behavior of <input type> where changing it from X to Y has an immediate
>> effect on the APIs available (like stepUp).
>
> Hmm.  That's a good point.  We should rope in Jonas and Olli on this bit.
>
> As long as it's ok to call attributeChanged right before the return from the
> attribute mutator, this seems to be a reasonable thing to me.

There's lots of tricky aspects of specifying this. For example if
WebComponents support attribute forwarding (I haven't checked if it
does) then that means that all attributes will be forwarded before any
of the attribute-changed callbacks can run.

When setting .innerHTML, no attribute-changed callbacks will run until
all content has been parsed an inserted into the document.

When parsing the page, the attribute-changed callbacks can't run until
the end of the microtask.

There's likely a few more issues like that. But if these are
acceptable, then I think we could fire attribute changed callbacks
synchronously. This how we currently handle DOMAttrModified mutation
events.

/ Jonas
Received on Tuesday, 12 March 2013 08:43:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:58 GMT