Skip to content

Commit db463c2

Browse files
Sync svelte docs (#1041)
sync svelte docs Co-authored-by: Rich-Harris <1162160+Rich-Harris@users.noreply.github.com>
1 parent 2ed7da6 commit db463c2

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

apps/svelte.dev/content/docs/svelte/98-reference/.generated/compile-warnings.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,32 @@ In some situations a selector may target an element that is not 'visible' to the
630630
Self-closing HTML tags for non-void elements are ambiguous — use `<%name% ...></%name%>` rather than `<%name% ... />`
631631
```
632632

633+
In HTML, there's [no such thing as a self-closing tag](https://jakearchibald.com/2023/against-self-closing-tags-in-html/). While this _looks_ like a self-contained element with some text next to it...
634+
635+
```html
636+
<div>
637+
<span class="icon" /> some text!
638+
</div>
639+
```
640+
641+
...a spec-compliant HTML parser (such as a browser) will in fact parse it like this, with the text _inside_ the icon:
642+
643+
```html
644+
<div>
645+
<span class="icon"> some text! </span>
646+
</div>
647+
```
648+
649+
Some templating languages (including Svelte) will 'fix' HTML by turning `<span />` into `<span></span>`. Others adhere to the spec. Both result in ambiguity and confusion when copy-pasting code between different contexts, and as such Svelte prompts you to resolve the ambiguity directly by having an explicit closing tag.
650+
651+
To automate this, run the dedicated migration:
652+
653+
```bash
654+
npx sv migrate self-closing-tags
655+
```
656+
657+
In a future version of Svelte, self-closing tags may be upgraded from a warning to an error.
658+
633659
### event_directive_deprecated
634660

635661
```

apps/svelte.dev/content/docs/svelte/98-reference/30-compiler-warnings.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,32 @@ In some situations a selector may target an element that is not 'visible' to the
651651
Self-closing HTML tags for non-void elements are ambiguous — use `<%name% ...></%name%>` rather than `<%name% ... />`
652652
```
653653

654+
In HTML, there's [no such thing as a self-closing tag](https://jakearchibald.com/2023/against-self-closing-tags-in-html/). While this _looks_ like a self-contained element with some text next to it...
655+
656+
```html
657+
<div>
658+
<span class="icon" /> some text!
659+
</div>
660+
```
661+
662+
...a spec-compliant HTML parser (such as a browser) will in fact parse it like this, with the text _inside_ the icon:
663+
664+
```html
665+
<div>
666+
<span class="icon"> some text! </span>
667+
</div>
668+
```
669+
670+
Some templating languages (including Svelte) will 'fix' HTML by turning `<span />` into `<span></span>`. Others adhere to the spec. Both result in ambiguity and confusion when copy-pasting code between different contexts, and as such Svelte prompts you to resolve the ambiguity directly by having an explicit closing tag.
671+
672+
To automate this, run the dedicated migration:
673+
674+
```bash
675+
npx sv migrate self-closing-tags
676+
```
677+
678+
In a future version of Svelte, self-closing tags may be upgraded from a warning to an error.
679+
654680
### event_directive_deprecated
655681

656682
```

0 commit comments

Comments
 (0)