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

On Mon, Mar 11, 2013 at 5:45 PM, Boris Zbarsky <> 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

/ Jonas

Received on Tuesday, 12 March 2013 08:43:51 UTC