From e4926d7507e128d2b13e2936131c10133fdbd920 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 19 Sep 2024 19:38:40 +0200 Subject: [PATCH] docs: note html structure breaking change (#12991) --- .../03-appendix/02-breaking-changes.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md b/sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md index b217af1d71..ec1dfaeb34 100644 --- a/sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md +++ b/sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md @@ -261,6 +261,32 @@ This is a footgun. In runes mode, if you want to concatenate stuff you must wrap Note that Svelte 5 will also warn if you have a single expression wrapped in quotes, like `answer="{42}"` — in Svelte 6, that will cause the value to be converted to a string, rather than passed as a number. +### HTML structure is stricter + +In Svelte 4, you were allowed to write HTML code that would be repaired by the browser when server side rendering it. For example you could write this... + +```svelte + + + + +
hi
+``` + +... and the browser would auto-insert a `` element: + +```svelte + + + + + + +
hi
+``` + +Svelte 5 is more strict about the HTML structure and will throw a compiler error in cases where the browser would repair the DOM. + ## Other breaking changes ### Stricter `@const` assignment validation