diff --git a/src/compiler/compile/nodes/EachBlock.ts b/src/compiler/compile/nodes/EachBlock.ts index bb78845dd9..0ef5baf181 100644 --- a/src/compiler/compile/nodes/EachBlock.ts +++ b/src/compiler/compile/nodes/EachBlock.ts @@ -63,7 +63,7 @@ export default class EachBlock extends AbstractBlock { ([this.const_tags, this.children] = get_const_tags(info.children, component, this, this)); if (this.has_animation) { - this.children = this.children.filter(child => !isEmptyNode(child)); + this.children = this.children.filter(child => !(child.type == 'Comment' || isEmptyNode(child))); if (this.children.length !== 1) { const child = this.children.find(child => !!(child as Element).animation); diff --git a/test/validator/samples/animation-each-with-comment/errors.json b/test/validator/samples/animation-each-with-comment/errors.json new file mode 100644 index 0000000000..0637a088a0 --- /dev/null +++ b/test/validator/samples/animation-each-with-comment/errors.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test/validator/samples/animation-each-with-comment/input.svelte b/test/validator/samples/animation-each-with-comment/input.svelte new file mode 100644 index 0000000000..5c32ef5dfb --- /dev/null +++ b/test/validator/samples/animation-each-with-comment/input.svelte @@ -0,0 +1,11 @@ + + +