Skip to content

Commit f716298

Browse files
committed
Error if multiple children with an animated snippet
1 parent f8e47af commit f716298

File tree

1 file changed

+6
-0
lines changed
  • packages/svelte/src/compiler/phases/2-analyze/visitors

1 file changed

+6
-0
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/RenderTag.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ export function RenderTag(node, context) {
6363
}
6464
else if (!parent.key) {
6565
e.animation_missing_key(parent);
66+
} else if (parent.body.nodes.filter((n) =>
67+
n.type !== 'Comment' &&
68+
n.type !== 'ConstTag' &&
69+
(n.type !== 'Text' || n.data.trim() !== '')).length > 1
70+
) {
71+
e.animation_invalid_placement(node);
6672
}
6773
}
6874

0 commit comments

Comments
 (0)