diff --git a/src/app/template_set.ts b/src/app/template_set.ts index e593a794..81ea996f 100644 --- a/src/app/template_set.ts +++ b/src/app/template_set.ts @@ -1,9 +1,9 @@ -import { createBlock, html, list, multi, text, toggler } from "../blockdom"; +import { createBlock, html, list, multi, text, toggler, comment } from "../blockdom"; import { compile, Template } from "../compiler"; import { component } from "../component/component_node"; import { UTILS } from "./template_helpers"; -const bdom = { text, createBlock, list, multi, html, toggler, component }; +const bdom = { text, createBlock, list, multi, html, toggler, component, comment }; export const globalTemplates: { [key: string]: string | Node } = {}; diff --git a/src/blockdom/index.ts b/src/blockdom/index.ts index aa459e4d..0b6d05b0 100644 --- a/src/blockdom/index.ts +++ b/src/blockdom/index.ts @@ -4,7 +4,7 @@ export { toggler } from "./toggler"; export { createBlock } from "./block_compiler"; export { list } from "./list"; export { multi } from "./multi"; -export { text } from "./text"; +export { text, comment } from "./text"; export { html } from "./html"; export interface VNode { diff --git a/src/blockdom/text.ts b/src/blockdom/text.ts index 084d53db..6bf7d882 100644 --- a/src/blockdom/text.ts +++ b/src/blockdom/text.ts @@ -8,18 +8,17 @@ const nodeInsertBefore = nodeProto.insertBefore; const characterDataSetData = getDescriptor(characterDataProto, "data").set!; const nodeRemoveChild = nodeProto.removeChild; -class VText { +abstract class VSimpleNode { text: string; parentEl?: HTMLElement | undefined; - el?: Text; + el?: any; constructor(text: string) { this.text = text; } - mount(parent: HTMLElement, afterNode: Node | null) { + mountNode(node: Node, parent: HTMLElement, afterNode: Node | null) { this.parentEl = parent; - const node = document.createTextNode(toText(this.text)); nodeInsertBefore.call(parent, node, afterNode); this.el = node; } @@ -29,14 +28,6 @@ class VText { nodeInsertBefore.call(this.parentEl, this.el!, target); } - patch(other: VText) { - const text2 = other.text; - if (this.text !== text2) { - characterDataSetData.call(this.el!, toText(text2)); - this.text = text2; - } - } - beforeRemove() {} remove() { @@ -52,10 +43,36 @@ class VText { } } +class VText extends VSimpleNode { + mount(parent: HTMLElement, afterNode: Node | null) { + this.mountNode(document.createTextNode(toText(this.text)), parent, afterNode); + } + + patch(other: VText) { + const text2 = other.text; + if (this.text !== text2) { + characterDataSetData.call(this.el!, toText(text2)); + this.text = text2; + } + } +} + +class VComment extends VSimpleNode { + mount(parent: HTMLElement, afterNode: Node | null) { + this.mountNode(document.createComment(toText(this.text)), parent, afterNode); + } + + patch() {} +} + export function text(str: string): VNode { return new VText(str); } +export function comment(str: string): VNode { + return new VComment(str); +} + export function toText(value: any): string { switch (typeof value) { case "string": diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts index 8731b136..ac2c4db0 100644 --- a/src/compiler/code_generator.ts +++ b/src/compiler/code_generator.ts @@ -21,7 +21,7 @@ import { ASTType, } from "./parser"; -type BlockType = "block" | "text" | "multi" | "list" | "html"; +type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment"; export interface Config { translateFn?: (s: string) => string; @@ -227,7 +227,7 @@ export class CodeGenerator { // define blocks and utility functions let mainCode = [ - ` let { text, createBlock, list, multi, html, toggler, component } = bdom;`, + ` let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;`, `let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers;`, ]; if (this.templateName) { @@ -443,13 +443,14 @@ export class CodeGenerator { let { block, forceNewBlock } = ctx; const isNewBlock = !block || forceNewBlock; if (isNewBlock) { - block = this.createBlock(block, "block", ctx); - this.blocks.push(block); - } - const text = xmlDoc.createComment(ast.value); - block!.insert(text); - if (isNewBlock) { - this.insertBlock("", block!, ctx); + block = this.createBlock(block, "comment", ctx); + this.insertBlock(`comment(\`${ast.value}\`)`, block, { + ...ctx, + forceNewBlock: forceNewBlock && !block, + }); + } else { + const text = xmlDoc.createComment(ast.value); + block!.insert(text); } } diff --git a/src/index.ts b/src/index.ts index 8e087c1e..d16e52e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,7 @@ import { remove, text, toggler, + comment, } from "./blockdom"; import { mainEventHandler } from "./component/handler"; @@ -28,6 +29,7 @@ export const blockDom = { toggler, createBlock, html, + comment, }; import type { AppConfig } from "./app/app"; diff --git a/tests/__snapshots__/reactivity.test.ts.snap b/tests/__snapshots__/reactivity.test.ts.snap index 92f063f4..1695cfbb 100644 --- a/tests/__snapshots__/reactivity.test.ts.snap +++ b/tests/__snapshots__/reactivity.test.ts.snap @@ -49,7 +49,7 @@ exports[`Reactivity: useState concurrent renderings 3`] = ` exports[`Reactivity: useState destroyed component before being mounted is inactive 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -64,7 +64,7 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti exports[`Reactivity: useState destroyed component before being mounted is inactive 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -82,7 +82,7 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti exports[`Reactivity: useState destroyed component is inactive 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -97,7 +97,7 @@ exports[`Reactivity: useState destroyed component is inactive 1`] = ` exports[`Reactivity: useState destroyed component is inactive 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -115,7 +115,7 @@ exports[`Reactivity: useState destroyed component is inactive 2`] = ` exports[`Reactivity: useState one components can subscribe twice to same context 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -131,7 +131,7 @@ exports[`Reactivity: useState one components can subscribe twice to same context exports[`Reactivity: useState parent and children subscribed to same context 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -146,7 +146,7 @@ exports[`Reactivity: useState parent and children subscribed to same context 1`] exports[`Reactivity: useState parent and children subscribed to same context 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -225,7 +225,7 @@ exports[`Reactivity: useState several nodes on different level use same context exports[`Reactivity: useState two components are updated in parallel 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -240,7 +240,7 @@ exports[`Reactivity: useState two components are updated in parallel 1`] = ` exports[`Reactivity: useState two components are updated in parallel 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -256,7 +256,7 @@ exports[`Reactivity: useState two components are updated in parallel 2`] = ` exports[`Reactivity: useState two components can subscribe to same context 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -271,7 +271,7 @@ exports[`Reactivity: useState two components can subscribe to same context 1`] = exports[`Reactivity: useState two components can subscribe to same context 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -287,7 +287,7 @@ exports[`Reactivity: useState two components can subscribe to same context 2`] = exports[`Reactivity: useState two independent components on different levels are updated in parallel 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -302,7 +302,7 @@ exports[`Reactivity: useState two independent components on different levels are exports[`Reactivity: useState two independent components on different levels are updated in parallel 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -317,7 +317,7 @@ exports[`Reactivity: useState two independent components on different levels are exports[`Reactivity: useState two independent components on different levels are updated in parallel 3`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -333,7 +333,7 @@ exports[`Reactivity: useState two independent components on different levels are exports[`Reactivity: useState useContext=useState hook is reactive, for one component 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -348,7 +348,7 @@ exports[`Reactivity: useState useContext=useState hook is reactive, for one comp exports[`Reactivity: useState useless atoms should be deleted 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -363,7 +363,7 @@ exports[`Reactivity: useState useless atoms should be deleted 1`] = ` exports[`Reactivity: useState useless atoms should be deleted 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
Total: Count:
\`); @@ -388,7 +388,7 @@ exports[`Reactivity: useState useless atoms should be deleted 2`] = ` exports[`Reactivity: useState very simple use, with initial value 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); diff --git a/tests/blockdom/comment.test.ts b/tests/blockdom/comment.test.ts new file mode 100644 index 00000000..ce0cefe3 --- /dev/null +++ b/tests/blockdom/comment.test.ts @@ -0,0 +1,26 @@ +import { comment, mount } from "../../src/blockdom"; +import { makeTestFixture } from "./helpers"; + +//------------------------------------------------------------------------------ +// Setup and helpers +//------------------------------------------------------------------------------ + +let fixture: HTMLElement; + +beforeEach(() => { + fixture = makeTestFixture(); +}); + +afterEach(() => { + fixture.remove(); +}); + +test("simple comment node", async () => { + const tree = comment("foo"); + expect(tree.el).toBe(undefined); + mount(tree, fixture); + expect(fixture.innerHTML).toBe(""); + expect(tree.el).not.toBe(undefined); + tree.remove(); + expect(fixture.innerHTML).toBe(""); +}); diff --git a/tests/compiler/__snapshots__/attributes.test.ts.snap b/tests/compiler/__snapshots__/attributes.test.ts.snap index bc23ac7f..152f159f 100644 --- a/tests/compiler/__snapshots__/attributes.test.ts.snap +++ b/tests/compiler/__snapshots__/attributes.test.ts.snap @@ -3,7 +3,7 @@ exports[`attributes changing a class with t-att-class (preexisting class 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -18,7 +18,7 @@ exports[`attributes changing a class with t-att-class (preexisting class 1`] = ` exports[`attributes changing a class with t-att-class 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -33,7 +33,7 @@ exports[`attributes changing a class with t-att-class 1`] = ` exports[`attributes changing an attribute with t-att- 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -48,7 +48,7 @@ exports[`attributes changing an attribute with t-att- 1`] = ` exports[`attributes class and t-att-class should combine together 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -63,7 +63,7 @@ exports[`attributes class and t-att-class should combine together 1`] = ` exports[`attributes class and t-attf-class with ternary operation 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -78,7 +78,7 @@ exports[`attributes class and t-attf-class with ternary operation 1`] = ` exports[`attributes dynamic attribute evaluating to 0 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -93,7 +93,7 @@ exports[`attributes dynamic attribute evaluating to 0 1`] = ` exports[`attributes dynamic attribute falsy variable 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -108,7 +108,7 @@ exports[`attributes dynamic attribute falsy variable 1`] = ` exports[`attributes dynamic attribute with a dash 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -123,7 +123,7 @@ exports[`attributes dynamic attribute with a dash 1`] = ` exports[`attributes dynamic attributes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -138,7 +138,7 @@ exports[`attributes dynamic attributes 1`] = ` exports[`attributes dynamic class attribute 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -153,7 +153,7 @@ exports[`attributes dynamic class attribute 1`] = ` exports[`attributes dynamic class attribute evaluating to 0 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -168,7 +168,7 @@ exports[`attributes dynamic class attribute evaluating to 0 1`] = ` exports[`attributes dynamic empty class attribute 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -183,7 +183,7 @@ exports[`attributes dynamic empty class attribute 1`] = ` exports[`attributes dynamic formatted attributes with a dash 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -198,7 +198,7 @@ exports[`attributes dynamic formatted attributes with a dash 1`] = ` exports[`attributes fixed variable 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -213,7 +213,7 @@ exports[`attributes fixed variable 1`] = ` exports[`attributes format expression 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -228,7 +228,7 @@ exports[`attributes format expression 1`] = ` exports[`attributes format literal 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -243,7 +243,7 @@ exports[`attributes format literal 1`] = ` exports[`attributes format multiple 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -258,7 +258,7 @@ exports[`attributes format multiple 1`] = ` exports[`attributes format value 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -273,7 +273,7 @@ exports[`attributes format value 1`] = ` exports[`attributes from object variables set previously 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -291,7 +291,7 @@ exports[`attributes from object variables set previously 1`] = ` exports[`attributes from variables set previously (no external node) 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -309,7 +309,7 @@ exports[`attributes from variables set previously (no external node) 1`] = ` exports[`attributes from variables set previously 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -327,7 +327,7 @@ exports[`attributes from variables set previously 1`] = ` exports[`attributes object 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -342,7 +342,7 @@ exports[`attributes object 1`] = ` exports[`attributes static attributes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -356,7 +356,7 @@ exports[`attributes static attributes 1`] = ` exports[`attributes static attributes on void elements 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\\"Test\\"/\`); @@ -370,7 +370,7 @@ exports[`attributes static attributes on void elements 1`] = ` exports[`attributes static attributes with dashes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -384,7 +384,7 @@ exports[`attributes static attributes with dashes 1`] = ` exports[`attributes t-att-class and class should combine together 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -399,7 +399,7 @@ exports[`attributes t-att-class and class should combine together 1`] = ` exports[`attributes t-att-class with multiple classes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -414,7 +414,7 @@ exports[`attributes t-att-class with multiple classes 1`] = ` exports[`attributes t-att-class with multiple classes 2`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -429,7 +429,7 @@ exports[`attributes t-att-class with multiple classes 2`] = ` exports[`attributes t-att-class with multiple classes, some of which are duplicate 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -444,7 +444,7 @@ exports[`attributes t-att-class with multiple classes, some of which are duplica exports[`attributes t-att-class with object 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -459,7 +459,7 @@ exports[`attributes t-att-class with object 1`] = ` exports[`attributes t-attf-class 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -474,7 +474,7 @@ exports[`attributes t-attf-class 1`] = ` exports[`attributes t-attf-class should combine with class 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -489,7 +489,7 @@ exports[`attributes t-attf-class should combine with class 1`] = ` exports[`attributes t-attf-class with multiple classes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -504,7 +504,7 @@ exports[`attributes t-attf-class with multiple classes 1`] = ` exports[`attributes t-attf-class with multiple classes separated by multiple spaces 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -519,7 +519,7 @@ exports[`attributes t-attf-class with multiple classes separated by multiple spa exports[`attributes tuple literal 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -534,7 +534,7 @@ exports[`attributes tuple literal 1`] = ` exports[`attributes tuple variable 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -549,7 +549,7 @@ exports[`attributes tuple variable 1`] = ` exports[`attributes two classes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -563,7 +563,7 @@ exports[`attributes two classes 1`] = ` exports[`attributes two dynamic attributes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -579,7 +579,7 @@ exports[`attributes two dynamic attributes 1`] = ` exports[`attributes updating classes (with obj notation) 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -594,7 +594,7 @@ exports[`attributes updating classes (with obj notation) 1`] = ` exports[`attributes various escapes 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
\`); @@ -611,7 +611,7 @@ exports[`attributes various escapes 1`] = ` exports[`attributes various escapes 2 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`
<
\`); @@ -625,7 +625,7 @@ exports[`attributes various escapes 2 1`] = ` exports[`special cases for some specific html attributes/properties input of type checkbox with t-att-indeterminate 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -640,7 +640,7 @@ exports[`special cases for some specific html attributes/properties input of typ exports[`special cases for some specific html attributes/properties input type= checkbox, with t-att-checked 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -655,7 +655,7 @@ exports[`special cases for some specific html attributes/properties input type= exports[`special cases for some specific html attributes/properties input with t-att-value 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -670,7 +670,7 @@ exports[`special cases for some specific html attributes/properties input with t exports[`special cases for some specific html attributes/properties select with t-att-value 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`\`); @@ -685,7 +685,7 @@ exports[`special cases for some specific html attributes/properties select with exports[`special cases for some specific html attributes/properties textarea with t-att-value 1`] = ` "function anonymous(bdom, helpers ) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; + let { text, createBlock, list, multi, html, toggler, component, comment } = bdom; let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, isBoundary, shallowEqual, setContextValue, toNumber, safeOutput } = helpers; let block1 = createBlock(\`