[Bug 21962] [Custom]: Running lifecycle callbacks should be integrated with microtask processing

https://www.w3.org/Bugs/Public/show_bug.cgi?id=21962

--- Comment #6 from Dimitri Glazkov <dglazkov@chromium.org> ---
(In reply to comment #5)
> So it seems to me that Lifecyle events are similar enough to mutation
> observers that makes sense considering abstracting the mutation observer
> delivery mechanism to essentially allow Lifecycle event callbacks to act as
> observers.
> 
> Imagine that HTML defines an abstract EOMT processing model like:
> 
> -EOMTWorker
> 
> static Vector<EOMTWorker> activeWorkers
> 
> static activateWorker(EOMTWorker worker) {
>   if (!activeWorkers.contains(worker))
>     activeWorkers.append(worker);
> }
> 
> static isDelivering = false;
> 
> static processEOMTCheckpoint() {
>   if (isDelivering)
>     return;
>   isDelivering = true;
> 
>   while (!activeWorkers.empty()) {
>     deliverNow = activeWorkers.copy();
>     activeWorkers.clear();
>     forEach worker in deliverNow {
>       worker.invoke(); // may run script, which may activate other workers
>                        // may also decide to do nothing if it no longer
> needs to
>     }
>   }
> 
>   isDelivering = false;
> }

I agree. The spec already has sorting tables as a separate sequential step in
microtask checkpoint, which means we could definitely end up  with pending
sorts when exiting the the checkpoint:

http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#perform-a-microtask-checkpoint

Should attempt to monkey-patch this in custom elements spec? That seems a bit
crazy :)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 22 May 2013 22:29:27 UTC