Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Remove comments from each block with animate #7146

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/compiler/compile/nodes/EachBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
11 changes: 11 additions & 0 deletions test/validator/samples/animation-each-with-comment/input.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
function flip() {}
</script>

<div>
{#each [] as n (n)}
<!-- Comment -->
<!-- <div animate:flip></div> -->
<div animate:flip />
{/each}
</div>