Skip to content

fix(html): keep a dynamic tag's attribute name from opening raw text mode - #4152

Open
RaphaelFakhri wants to merge 2 commits into
solidjs:nextfrom
RaphaelFakhri:fix/html-dynamic-tag-raw-text-attr
Open

RaphaelFakhri wants to merge 2 commits into
solidjs:nextfrom
RaphaelFakhri:fix/html-dynamic-tag-raw-text-attr

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

In @solidjs/html, a dynamic tag whose first attribute is named like a raw text element fails to parse:

html`<${Link} title="Home"><b>Home</b></${Link}>`;
// Error: Unclosed tag for <0>

The tokenizer records the first identifier it sees inside a tag as the tag name. A dynamic tag's name is an expression, so the first attribute name (title, style, script, textarea, noscript) takes its place. On >, the tokenizer enters raw text mode and looks for </title>, so the children and the </${Link}> closing tag are read as text.

This change records the tag name only for the identifier directly after <.

How did you test this change?

Added a test to packages/html/test/tokenize.test.ts and one to packages/html/test/parse.test.ts. Both fail before the fix and pass after it.

In packages/html:

  • npx vitest run test/tokenize.test.ts test/parse.test.ts without the fix: 2 failed, 123 passed.
  • Same command with the fix: 125 passed.
  • npx vitest run after pnpm build: 4 files, 208 tests passed.
  • npx prettier --check on the changed files: clean.

Fixes #4151

@changeset-bot

changeset-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b0721aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@solidjs/html Patch
test-integration Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal Patch
@solidjs/web Patch
board-example Patch
server-dbmon-example Patch
todos-server-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codspeed

codspeed Bot commented Oct 19, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 3 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 196 untouched benchmarks
⏩ 5 skipped benchmarks1


Comparing RaphaelFakhri:fix/html-dynamic-tag-raw-text-attr (2230643) with next (a9f7e2d)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants