atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.15k stars 43 forks source link

Template tags that end with a whitespace cause an error #108

Open oskarrough opened 1 year ago

oskarrough commented 1 year ago

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.

Expected behavior

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