solid icon indicating copy to clipboard operation
solid copied to clipboard

[html] `html` template function throws error, if no tags are included

Open JeredArc opened this issue 1 year ago • 0 comments

Describe the bug

If the html template function is called with a template string that doesn't contain any tags – or even with an empty template string – it throws an uncaught TypeError: Cannot read properties of undefined (reading 'name')

This might be connected to #2299 which describes text content before the first tag being ignored. So pretending, this were the desired behaviour, a call to html with a string without tags equals a call with an empty template string. Still an empty string shouldn't make it fail.

Your Example Website or App

https://playground.solidjs.com/anonymous/09d9efad-1d6d-4b3a-bb69-d6b24112b91f

Steps to Reproduce the Bug or Issue

Run html`Some string without tags` or html`` and it will throw an error.

Expected behavior

It should just return the input as plain string (in order to generate a text node out of it).

Screenshots or Videos

No response

Platform

Tested on (but most probably not the reason for the issue):

  • OS: macOS
  • Browser: Brave
  • Version: 1.70.123 (Chromium: 129.0.6668.89, arm64)

Additional context

No response

JeredArc avatar Oct 09 '24 13:10 JeredArc