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

Why does <script> tag contained in <template> force MutationObserver to return early? #42230

Open
miragecraft opened this issue Sep 28, 2023 · 1 comment

Comments

@miragecraft
Copy link

miragecraft commented Sep 28, 2023

I'm investigating the behaviour outlined in #35393 and I don't understand the "correct" behaviour.

Sure, if a <script> runs it should trigger microtask cleanup, but a <script> tag contained within <template> does NOT run.

It makes no sense in this context.

I want to make changes to <template> tags synchronous via MutationObserver and this weird behaviour kneecaps that effort because I'm not guaranteed to have all template content available if it contains any <script> tag.

The fact that <script> tag within <template> triggers microtask cleanup should be considered a bug, not a feature.

@JRJurman
Copy link
Contributor

I discovered this behavior recently, and was able work around it by checking if there were TEXT nodes at the end - details here: https://stackoverflow.com/a/77115327/864715

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