diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index 23b86f0d34..ef5aa8a18e 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -373,14 +373,13 @@ export default class ElementWrapper extends Wrapper { block.chunks.destroy.push(b`if (detaching) @detach(${node});`); } - let staticChildren = null; - // insert static children with textContent or innerHTML const can_use_textcontent = this.can_use_textcontent(); if (!this.node.namespace && (this.can_use_innerhtml || can_use_textcontent) && this.fragment.nodes.length > 0) { if (this.fragment.nodes.length === 1 && this.fragment.nodes[0].node.type === 'Text') { - staticChildren = b`${node}.textContent = ${string_literal((this.fragment.nodes[0] as TextWrapper).data)};`; - block.chunks.create.push(staticChildren); + block.chunks.create.push( + b`${node}.textContent = ${string_literal((this.fragment.nodes[0] as TextWrapper).data)};` + ); } else { const state = { quasi: { @@ -399,8 +398,9 @@ export default class ElementWrapper extends Wrapper { to_html((this.fragment.nodes as unknown as Array), block, literal, state, can_use_raw_text); literal.quasis.push(state.quasi); - staticChildren = b`${node}.${this.can_use_innerhtml ? 'innerHTML' : 'textContent'} = ${literal};`; - block.chunks.create.push(staticChildren); + block.chunks.create.push( + b`${node}.${this.can_use_innerhtml ? 'innerHTML' : 'textContent'} = ${literal};` + ); } } else { this.fragment.nodes.forEach((child: Wrapper) => {