Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-penguins-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: skip comment nodes in snippet validation logic
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export function SnippetBlock(node, context) {
) {
if (
parent.fragment.nodes.some(
(node) => node.type !== 'SnippetBlock' && (node.type !== 'Text' || node.data.trim())
(node) =>
node.type !== 'SnippetBlock' &&
(node.type !== 'Text' || node.data.trim()) &&
node.type !== 'Comment'
)
) {
e.snippet_conflict(node);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
const { children } = $props();
</script>

{@render children()}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { test } from '../../test';

export default test({
html: `The content`
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
import Child from "./Child.svelte"
</script>

<Child>
<!-- I'm just a poor comment -->
{#snippet children()}
The content
{/snippet}
</Child>