Skip to content

Commit e4926d7

Browse files
authored
docs: note html structure breaking change (#12991)
1 parent db6545d commit e4926d7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,32 @@ This is a footgun. In runes mode, if you want to concatenate stuff you must wrap
261261

262262
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.
263263

264+
### HTML structure is stricter
265+
266+
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...
267+
268+
```svelte
269+
<table>
270+
<tr>
271+
<td>hi</td>
272+
</tr>
273+
</table>
274+
```
275+
276+
... and the browser would auto-insert a `<tbody>` element:
277+
278+
```svelte
279+
<table>
280+
<tbody>
281+
<tr>
282+
<td>hi</td>
283+
</tr>
284+
</tbody>
285+
</table>
286+
```
287+
288+
Svelte 5 is more strict about the HTML structure and will throw a compiler error in cases where the browser would repair the DOM.
289+
264290
## Other breaking changes
265291

266292
### Stricter `@const` assignment validation

0 commit comments

Comments
 (0)