Skip to content

fix(deps): place asset tags only at the page's real </head> and </body>; release citry 1.1.0 - #806

Merged
JuroOravec merged 5 commits into
mainfrom
fix/asset-tag-placement
Nov 19, 2026
Merged

JuroOravec merged 5 commits into
mainfrom
fix/asset-tag-placement

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

(Opus 5.5)

What changed

  • Citry places its CSS and JS tags only where a browser sees a real </head> or </body> element, in any letter case. A new scanner (citry/util/_tag_scan.py) skips attribute values, comments and script text, and follows SVG, MathML, <select> and <template>. When a page could be read more than one way, a position is used only if every reading agrees; otherwise CSS goes at the start and JS at the end of the output. Runtime preload hints follow the same rule.
  • Release values for citry 1.1.0 (citry-core stays at 2.1.2; citry-ui is unchanged).

Checks

  • 65 scanner tests and 32 placement tests (17 fail on main), plus 24 browser tests in Chromium, Firefox and WebKit.
  • Full suite: 15,382 passed; the 2 failures also fail on main. ruff and mypy (also --platform linux) clean.
  • Three independent reviews; their findings are fixed with tests.
  • Serialize benchmarks: median about +3% over five runs (+2.0% to +3.6%); 1 to 2 MB pages dense with tags take 10 to 60 ms longer.

Versioning

citry 1.1.0 is a minor release: it also ships the Experimental APIs merged in #800, #801, #802, #803 and #805, and the fix from #799. The placement change keeps tags where they were on ordinary pages.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KUhrHaXagmW5ZxpRAMwyom

JuroOravec and others added 5 commits November 19, 2026 18:10
Read the HTML with the browser's tokenizer rules to find where CSS and
JS go, so end-tag text inside an attribute value, comment or raw text
is not taken for the tag. Matching ignores letter case. Where the
reading depends on the surrounding element, only positions every
reading agrees on are used; otherwise the tags go at the start or end.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHaXagmW5ZxpRAMwyom
Track the SVG and MathML elements a reading is inside, where <script>
and <style> are ordinary elements, and read raw text both ways wherever
that tracking is unreliable. Bound the scan's work so it stays linear,
and skip simple SVG blocks in one step. Place runtime preload hints only
at the </head> the scan agrees on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHaXagmW5ZxpRAMwyom
…nd template elements

Inside SVG and MathML, take a tag as self-closing without the slower
exact check only when all its attribute values are quoted or missing,
since in "x= />" the "/" belongs to the value. Track open <select> and
<template> elements so the page is read as plain HTML again after they
close, and read <script> both ways inside them (template content that
starts with <col> ignores it). Stop tracking past 256 open SVG elements
or 64 open select and template elements, and skip SVG and MathML
elements nested up to two levels in one step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KUhrHaXagmW5ZxpRAMwyom
@JuroOravec
JuroOravec merged commit cd2baae into main Nov 19, 2026
39 checks passed
@JuroOravec
JuroOravec deleted the fix/asset-tag-placement branch November 19, 2026 18:51
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.

1 participant