-
-
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
Incorrect HTML is generated #866
Comments
Wow, that's nuts. This works... div.innerHTML = "<span><i></i></span>\n\t<span><i></i></span>"; ...but this (the code that's being generated) fails: div.innerHTML = "<span><i/></span>\n\t<span><i/></span>"; I wonder what condition determines whether you can use a self-closing tag versus when you must have an opening and a closing tag. |
https://stackoverflow.com/questions/3558119/are-non-void-self-closing-tags-valid-in-html5 It sounds like according to the spec only void elements are allowed to be self-closing. I don't know how that corresponds to this weird behavior exactly, but it would probably be wise to only output self-closing elements for things we know are void elements - or actually to just output the lone tag e.g. |
@Conduitry your branch working for me very well. |
do not use self-closing tags in .innerHTML
Released 1.40.1 with the fix — thanks |
Hello.
I have HTML:
But Svelte outputs it in the following way:
I'm using version 1.4.0.
You can see it there: https://svelte.technology/repl?version=1.40.0&gist=5061e03f1ec98ae67e0e7d7a3da4963e
The text was updated successfully, but these errors were encountered: