diff --git a/src/compiler/compile/render_dom/Block.ts b/src/compiler/compile/render_dom/Block.ts index 56b5d08489..0b9784a6e8 100644 --- a/src/compiler/compile/render_dom/Block.ts +++ b/src/compiler/compile/render_dom/Block.ts @@ -423,17 +423,17 @@ export default class Block { const key = this.key && this.get_unique_name('key'); const args: any[] = [x`#ctx`]; - if (key) args.unshift(key); - // TODO include this.comment - // ${this.comment && `// ${escape(this.comment, { only_escape_at_symbol: true })}`} + const fn = b`function ${this.name}(${args}) { + ${this.get_contents(key)} + }`; - return b` - function ${this.name}(${args}) { - ${this.get_contents(key)} - } - `; + return this.comment + ? b` + // ${this.comment} + ${fn}` + : fn; } render_listeners(chunk: string = '') {