loreanvictor / rehtm

Create and hydrate HTML with HTM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't use DOM Nodes inside templates

loreanvictor opened this issue · comments

If you use another DOM Node inside a template (as a string passed to html, template, recipe, etc), it will result in a WrongAddressError (see sandbox):

import { html } from 'https://esm.sh/rehtm'

try {
  const c1 = html`<div>World!</div>`
  const c2 = html`<div>Halo ${c1}</div>`

  document.body.appendChild(c2)  
} catch (err) {
  console.log(err.message)
}
"Address  not found on [object DocumentFragment]. Best match: ."