mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 01:11:24 +01:00
deconflict tmp
within its fragment
This commit is contained in:
parent
d2a701c4f5
commit
e32e69f3e8
@ -78,7 +78,7 @@ class DomGenerator extends Generator {
|
||||
} else {
|
||||
properties.addBlock( deindent`
|
||||
update: function ( changed, ${fragment.params.join( ', ' )} ) {
|
||||
var ${this.alias( 'tmp' )};
|
||||
${fragment.tmp ? `var ${fragment.tmp};` : ''}
|
||||
|
||||
${fragment.builders.update}
|
||||
},
|
||||
|
@ -9,9 +9,12 @@ export default {
|
||||
generator.current.builders.init.addLine( `var last_${name} = ${snippet};` );
|
||||
generator.addElement( name, `${generator.helper( 'createText' )}( last_${name} )`, true );
|
||||
|
||||
if ( !generator.current.tmp ) {
|
||||
generator.current.tmp = generator.current.getUniqueName( 'tmp' );
|
||||
}
|
||||
generator.current.builders.update.addBlock( deindent`
|
||||
if ( ( ${generator.alias( 'tmp' )} = ${snippet} ) !== last_${name} ) {
|
||||
${name}.data = last_${name} = ${generator.alias( 'tmp' )};
|
||||
if ( ( ${generator.current.tmp} = ${snippet} ) !== last_${name} ) {
|
||||
${name}.data = last_${name} = ${generator.current.tmp};
|
||||
}
|
||||
` );
|
||||
}
|
||||
|
@ -26,9 +26,12 @@ export default {
|
||||
generator.current.builders.init.addLine( mountStatement );
|
||||
}
|
||||
|
||||
if ( !generator.current.tmp ) {
|
||||
generator.current.tmp = generator.current.getUniqueName( 'tmp' );
|
||||
}
|
||||
generator.current.builders.update.addBlock( deindent`
|
||||
if ( ( ${generator.alias( 'tmp' )} = ${snippet} ) !== last_${name} ) {
|
||||
last_${name} = ${generator.alias( 'tmp' )};
|
||||
if ( ( ${generator.current.tmp} = ${snippet} ) !== last_${name} ) {
|
||||
last_${name} = ${generator.current.tmp};
|
||||
${detachStatement}
|
||||
${mountStatement}
|
||||
}
|
||||
|
@ -105,9 +105,12 @@ export default function addElementAttributes ( generator, node, local ) {
|
||||
}
|
||||
|
||||
local.init.addLine( updater );
|
||||
if ( !generator.current.tmp ) {
|
||||
generator.current.tmp = generator.current.getUniqueName( 'tmp' );
|
||||
}
|
||||
local.update.addBlock( deindent`
|
||||
if ( ( ${generator.alias( 'tmp' )} = ${snippet} ) !== ${last} ) {
|
||||
${last} = ${generator.alias( 'tmp' )};
|
||||
if ( ( ${generator.current.tmp} = ${snippet} ) !== ${last} ) {
|
||||
${last} = ${generator.current.tmp};
|
||||
${updater}
|
||||
}
|
||||
` );
|
||||
|
Loading…
Reference in New Issue
Block a user