Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template batch mutations and side effects #906

Open
annevk opened this issue Oct 28, 2020 · 4 comments
Open

Template batch mutations and side effects #906

annevk opened this issue Oct 28, 2020 · 4 comments

Comments

@annevk
Copy link
Collaborator

annevk commented Oct 28, 2020

With whatwg/dom#808 still unsolved it seems somewhat hard to figure out how batch mutations would have to change that "unknown" model. (Because even if we disable mutation events, script and iframe insertions and such probably have to remain functioning.)

@justinfagnani
Copy link
Contributor

Because commit() actually applies the stages mutations, can it defer mutation events to fire after mutations and before CE reactions? Maybe this is the queue you're referring to in that issue.

@annevk
Copy link
Collaborator Author

annevk commented Oct 28, 2020

It's specifically about script and iframe insertions and they have their own queue as you can insert multiple together, but you don't want to execute them before they are all inserted. (Let's assume mutation events are completely disabled as that seems like a solid plan.)

@yuzhe-han
Copy link
Contributor

Wow, I see there's a lot of history in whatwg/dom#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. 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?

@annevk
Copy link
Collaborator Author

annevk commented Oct 29, 2020

I suspect that's roughly what we have to do, but given that user agents are not interoperable on those phases I don't think it can be tackled independently. We need to actually get agreement on that model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants