atomico icon indicating copy to clipboard operation
atomico copied to clipboard

Template tags that end with a whitespace cause an error

Open oskarrough opened this issue 2 years ago • 0 comments

Template tags that end with a whitespace cause an error. Here's an example. Notice the whitespace between </host> and the ending backtick.

function component() {
  return html`<host><p>Hello</p></host> `
}

Uncaught (in promise) TypeError: result.render is not a function

from https://github.com/atomicojs/atomico/blob/master/src/element/custom-element.js#L138-L139/

If I remove the whitespace, all is good. You could argue, why put a whitespace there anyway? And that's a fair question, but prettier is doing that for whatever reason.

  • Browser Edge 115.0
  • Vite 4.4.8
  • Atomico 1.72.0

Expected behavior

I'd expect the template to render whether it ends in a whitespace or not.

oskarrough avatar Aug 06 '23 12:08 oskarrough