pull/992/head
Rich Harris 8 years ago
parent a72a6ca476
commit f7d4994467

@ -13,8 +13,6 @@ import wrapModule from './wrapModule';
import annotateWithScopes, { Scope } from '../utils/annotateWithScopes';
import getName from '../utils/getName';
import clone from '../utils/clone';
import DomBlock from './dom/Block';
import SsrBlock from './server-side-rendering/Block';
import Stylesheet from '../css/Stylesheet';
import { test } from '../config';
import nodes from './nodes/index';

@ -134,9 +134,10 @@ export default class Block {
this.builders.create.addLine(`${name} = ${renderStatement};`);
this.builders.claim.addLine(`${name} = ${claimStatement};`);
this.mount(name, parentNode);
if (!parentNode) {
if (parentNode) {
this.builders.mount.addLine(`@appendNode(${name}, ${parentNode});`);
} else {
this.builders.mount.addLine(`@insertNode(${name}, #target, anchor);`);
this.builders.unmount.addLine(`@detachNode(${name});`);
}
}
@ -167,14 +168,6 @@ export default class Block {
return this.generator.contextualise(this.contexts, this.indexes, expression, context, isEventHandler);
}
mount(name: string, parentNode: string) {
if (parentNode) {
this.builders.mount.addLine(`@appendNode(${name}, ${parentNode});`);
} else {
this.builders.mount.addLine(`@insertNode(${name}, #target, anchor);`);
}
}
toString() {
let introing;
const hasIntros = !this.builders.intro.isEmpty();

Loading…
Cancel
Save