Re: [w3c/webcomponents] Unexpected upgrade timing when appending an element and script together (#606)

This is because the custom element is enqueued to be upgraded but we end up executing the script in the middle of executing `appendChild` (we run [**prepare a script**](https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script) step whenever the script element is [*connected*](https://dom.spec.whatwg.org/#connected) and a node or document fragment is [*inserted*](https://html.spec.whatwg.org/multipage/infrastructure.html#nodes-are-inserted) into the script element) which is earlier than when those reactions are invoked (at the end of `appendChild` before returning the control back to scripts).

If we're interested in just this particular case resolved, then we can add a special step to invoke custom elements callbacks in the script element's processing model, or check it in [*to insert*](https://dom.spec.whatwg.org/#concept-node-insert).

If we're trying to solve this problem in more broader sense, and invoke enqueued callbacks before executing any script, then that's a lot more profound change.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/606#issuecomment-260054414

Received on Friday, 11 November 2016 21:01:10 UTC