Merge branch 'master' of https://github.com/hville/svelte into hville-master

pull/597/head
Rich Harris 8 years ago
commit 1e14a62654

@ -155,8 +155,6 @@ function keyed ( generator: DomGenerator, block: Block, state: State, node: Node
function ${fn} ( iteration ) {
iteration.outro( function () {
iteration.destroy( true );
if ( iteration.next ) iteration.next.last = iteration.last;
if ( iteration.last ) iteration.last.next = iteration.next;
${lookup}[iteration.key] = null;
});
}
@ -179,8 +177,6 @@ function keyed ( generator: DomGenerator, block: Block, state: State, node: Node
block.builders.create.addBlock( deindent`
function ${fn} ( iteration ) {
iteration.destroy( true );
if ( iteration.next && iteration.next.last === iteration ) iteration.next.last = iteration.last;
if ( iteration.last && iteration.last.next === iteration ) iteration.last.next = iteration.next;
${lookup}[iteration.key] = null;
}
` );
@ -204,7 +200,7 @@ function keyed ( generator: DomGenerator, block: Block, state: State, node: Node
var ${each_block_value} = ${snippet};
var ${expected} = ${head};
var ${last};
var ${last} = null;
var discard_pile = [];
@ -220,24 +216,24 @@ function keyed ( generator: DomGenerator, block: Block, state: State, node: Node
} else {
if ( ${iteration} ) {
// probably a deletion
do {
while ( ${expected} && ${expected}.key !== ${key} ) {
${expected}.discard = true;
discard_pile.push( ${expected} );
${expected} = ${expected}.next;
} while ( ${expected} && ${expected}.key !== ${key} );
};
${expected} = ${expected} && ${expected}.next;
${iteration}.discard = false;
${iteration}.last = ${last};
${iteration}.next = ${expected};
${iteration}.mount( ${parentNode}, ${expected} ? ${expected}.first : ${anchor} );
if (!${expected}) ${iteration}.mount( ${parentNode}, ${anchor} );
} else {
// key is being inserted
${iteration} = ${lookup}[${key}] = ${create_each_block}( ${params}, ${each_block_value}, ${each_block_value}[${i}], ${i}, ${block.component}, ${key} );
${iteration}.${mountOrIntro}( ${parentNode}, ${expected}.first );
if ( ${expected} ) ${expected}.last = ${iteration};
${expected}.last = ${iteration};
${iteration}.next = ${expected};
}
}

Loading…
Cancel
Save