0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00

in each-else, use mount/intro according to that branch's contents (#1586)

Fixes # 1559
This commit is contained in:
Conduitry 2018-07-09 13:02:17 -04:00 committed by GitHub
parent e66d9ffae7
commit 26dfb9afa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 0 deletions

View File

@ -189,6 +189,7 @@ export default class EachBlock extends Node {
if (this.else) {
const each_block_else = compiler.getUniqueName(`${each}_else`);
const mountOrIntro = (this.else.block.hasIntroMethod || this.else.block.hasOutroMethod) ? 'i' : 'm';
block.builders.init.addLine(`var ${each_block_else} = null;`);

View File

@ -5,6 +5,7 @@ import mapChildren from './shared/mapChildren';
export default class ElseBlock extends Node {
type: 'ElseBlock';
children: Node[];
block: Block;
constructor(compiler, parent, scope, info) {
super(compiler, parent, scope, info);

View File

@ -0,0 +1 @@
Foo

View File

@ -0,0 +1,5 @@
export default {
nestedTransitions: true,
data: { items: [] },
html: `No items.`,
};

View File

@ -0,0 +1,9 @@
{#each items as item}
<Widget {item}/>
{:else}
No items.
{/each}
<script>
export default { components: { Widget: './Widget.html' } };
</script>