Files
hyperframes/packages
James RussoandClaude Fable 5.2 07e03e8fed fix(studio-server): preview head scripts land in the head when an attribute holds <head> text (#8704)
* fix(studio-server): place the preview variables tag by reading the document

The tag that carries `?variables=` into a preview was placed after the
first "<head" text in the file. That text can also sit inside an attribute
value or a comment, and a tag placed there is not a script: the page got no
variables and the <html> element picked up extra attributes.

core gains headContentStart, built on the tokenizer helpers htmlDocument
already has. It reads the document prefix the way a browser does (comments,
doctype, quoted attribute values) and returns the position after the real
<head> start tag, else after <html>, else after the doctype, else 0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(studio-server): place the GSAP fallback script by reading the document

The preview route put this script after the first literal "<head>" in the
page, which can be text inside an attribute value or a comment. It now uses
headContentStart, the same as the preview variables tag. A page whose head
tag has attributes also gets the script inside the head now, where before it
went ahead of the doctype.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix(core): headContentStart keeps a leading byte-order mark first

With no doctype, html or head tag the position was 0, ahead of the mark.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* chore(core): trim comments added with head placement

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 13:51:54 +00:00
..
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00
2026-11-24 13:29:30 +00:00