File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,8 +145,18 @@ export abstract class ElementComponent<T extends Element> extends NodeComponent<
145145 }
146146
147147 /**
148- * Append HTML
149- * @example component.html`<div>${component}</div>`
148+ * Append HTML.
149+ *
150+ * Any components (provided as `${...}` inside the HTML string literal)
151+ * remain fully functional and are appended (not just as HTML).
152+ * @example
153+ * component.html`<div>${new Component("button")
154+ * .text("Click me")
155+ * .on("click", () => console.log("clicked"))
156+ * }</div>`
157+ * // Event listeners etc. are preserved.
158+ * // Note the lack of parentheses.
159+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals Template literals (Template strings) - MDN
150160 */
151161 public html ( strings : TemplateStringsArray , ...components : NodeComponent < any > [ ] ) : this {
152162 return this . append ( this . tag ( strings , ...components ) ) ;
You can’t perform that action at this time.
0 commit comments