-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
<!>
is not valid XHTML regression in Svelte 5
#15799
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
Comments
I think this could be fixed by #15538 |
@paoloricciuti looks like it might. I think that approach would also fix #15801. Is there some way to test-drive #15538 without too much effort? Optimally, I would just have to replace a dependency line in |
Sure just do pnpm add https://pkg.pr.new/svelte@15538 |
@paoloricciuti ok, tested. I switch to functional templating mode, checked the JS file to see if it actually is active:
Looks good - and now my components also load in XHTML. Great work! How certain is it that this feature will be merged and approximately when? |
Almost certain, it's a prerequisite to advance on the custom renderer API. |
Describe the bug
Svelte 4 could be used on XHTML documents. With Svelte 5, this seems to be no longer the case.
One issue is that
<!>
is used as a hydration marker in Svelte 5.HTML fragments containing this marker can then be passed to
create_fragment_from_html
in reconciler.js:This then fails when trying to assign the HTML fragment to the
element.innerHTML
with the error message that the fragment is not valid XML.The only workaround I found was post-processing the generated JS file and replacing instances of
<!>
with<!---->
. With this replacement, the code seems to work. However, having to post-process the generated JS file using string operations is a really bad hack.I believe Svelte code should not use
<!>
but rather<!---->
to be compatible with XHTML/XML environments in the same way that Svelte 4 was.Reproduction
I don't think my report is vague.
Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: