-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Svelte may be improperly handling {@html}
expressions when used in <style>
and <script>
#9341
Comments
{@html}
expressions when used in <style>
and <script>
{@html}
expressions when used in <style>
and <script>
Overall, I'm not sure if this is a svelte bug, an unconsidered issue, or whether this is something the compiler could warn about or explicitly deny. Regardless I believe it's undefined behaviour |
I'm tempted to say that we should throw an error at dev time instead, I think you shouldn't use style or script tags with The alternative would be to have a check at runtime to special-case this, not sure it's worth it. |
@dummdidumm has svelte5 addressed the erroring aspect of this issue? I using svelte:element with script or style tags should be disallowed or throw a runtime error |
Revisiting this - I think it's ok to allow |
Describe the bug
Related to this issue/bug: BuilderIO/builder#2632
The Mitosis library converts the following source file
into the following svelte component
This issue results in CSS output during SSR to improperly render, injecting
<!-- HTML_TAG_START -->
and<!-- HTML_TAG_END -->
around the CSS code. This causes browsers to fail rendering CSS code leading to a flash of unstyled contentNow, this could be a bug of svelte - perhaps we should not be injecting those comment nodes when rendering inside of a style element
Additional notes
The exact same thing happens with the use of
{@html}
tags in<script>
sReproduction
N/A
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: