Re: [w3c/webcomponents] Template batch mutations and side effects (#906)

Wow, I see there's a lot of history in [whatwg/dom#808](https://github.com/whatwg/dom/issues/808). But I think those are separate issues from the parts batch commit(), and they can be tackled independently. 

For the batching concept, can we view the subtree where all the parts are being committed as a DocumentFragment, for the duration of the commit()?  Therefore, DOM insertions of scripts and iframes don't run immediately. Only after all the DOM mutations have been completed, does the UA initiate script execution and iframe loading, in the parts order inside a PartGroup.  

This way, each browser's behavior will be exactly as @annevk outline in the example, [issue/575](https://github.com/whatwg/dom/issues/575#issuecomment-366721142).  You can think of it as adding scripts and iframes to a DocumentFragment and inserting its content into the DOM.

This is just a conceptual framework. We don't need to make the whole subtree a DocumentFragment, then reinsert back into DOM. But it's to highlight the expected behavior.  UA can hold references to these part values and execute them afterward.

I think it may be necessary to define the two phases of batch commit: Phase_Mutation & Phase_Script. 

What do you think?


-- 
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/906#issuecomment-718305363

Received on Thursday, 29 October 2020 01:42:27 UTC