Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
JeredArc opened this issue Oct 9, 2024 · 0 comments
Open
Labels
alternative templating Related to non-JSX template engines

Comments

@JeredArc
Copy link

JeredArc commented Oct 9, 2024

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

@ryansolid ryansolid added the alternative templating Related to non-JSX template engines label Oct 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
alternative templating Related to non-JSX template engines
Projects
None yet
Development

No branches or pull requests

2 participants