mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
fix detach order for triples
This commit is contained in:
parent
5fa2cd24c4
commit
83fe123a5c
@ -76,10 +76,14 @@ export default function generate ( parsed, source, options, names ) {
|
||||
fragment.builders.init.addLine( `${fragment.autofocus}.focus();` );
|
||||
}
|
||||
|
||||
if ( !fragment.builders.detach.isEmpty() ) {
|
||||
// minor hack – we need to ensure that any {{{triples}}} are detached
|
||||
// first, so we append normal detach statements to detachRaw
|
||||
fragment.builders.detachRaw.addBlock( fragment.builders.detach );
|
||||
|
||||
if ( !fragment.builders.detachRaw.isEmpty() ) {
|
||||
fragment.builders.teardown.addBlock( deindent`
|
||||
if ( detach ) {
|
||||
${fragment.builders.detach}
|
||||
${fragment.builders.detachRaw}
|
||||
}
|
||||
` );
|
||||
}
|
||||
@ -171,6 +175,7 @@ export default function generate ( parsed, source, options, names ) {
|
||||
mount: new CodeBuilder(),
|
||||
update: new CodeBuilder(),
|
||||
detach: new CodeBuilder(),
|
||||
detachRaw: new CodeBuilder(),
|
||||
teardown: new CodeBuilder()
|
||||
};
|
||||
},
|
||||
@ -293,7 +298,7 @@ export default function generate ( parsed, source, options, names ) {
|
||||
target: 'target',
|
||||
elementDepth: 0,
|
||||
localElementDepth: 0,
|
||||
|
||||
|
||||
contexts: {},
|
||||
indexes: {},
|
||||
|
||||
|
@ -32,12 +32,6 @@ export default {
|
||||
generator.current.builders.update.addBlock( detachStatement );
|
||||
generator.current.builders.update.addBlock( mountStatement );
|
||||
|
||||
// if ( isToplevel ) {
|
||||
// const { detachStatements } = generator.current;
|
||||
// // we need `before` and `after` to still be in the DOM when running the
|
||||
// // detach code, so splice in the detach code *before* detaching
|
||||
// // `before`/`after`.
|
||||
// detachStatements.splice( detachStatements.length - 2, 0, detachStatement);
|
||||
// }
|
||||
generator.current.builders.detachRaw.addBlock( detachStatement );
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user