-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
Given this markup:
<p><div>hi</div></p>...svelte 4 would happily compile and even render this (REPL).
The svelte 5 compiler correctly considers this a syntax error and provides a helpful error message (REPL):
</p> attempted to close element that was already automatically closed by <div>
However, when adding another element in between the div and p, e.g. <p><span><div></div></span></p>, it compiles without error. The JS output includes:
var frag = $.template(`<p><span><div></div></span></p>`);Reproduction
This compiles:
<p><span><div>hi</div></span></p>...and, when rendered, results in <p><span></span></p> (REPL).
This also compiles:
<script>let hi = $state('hi');</script>
<p><span><div>{hi}</div></span></p>...and, when rendered, results in a confusing TypeError (REPL):
'get firstChild' called on an object that does not implement interface Node.
System Info
System:
OS: Linux 6.6 Fedora Linux 39 (KDE Plasma)
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 20.10.0
npm: 10.2.3
pnpm: 8.13.1
npmPackages:
svelte: 5.0.0-next.30 => 5.0.0-next.30Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels