Context
Cross-engine validation of the generic-selector rewrite sweep (a[href], PR #67 follow-up) found a one-anchor edit-count difference on ebay.html: this engine edits 374 anchors, lol-html edits 373. The divergent anchor sits inside <noscript>:
<noscript class="gh-t gh-spr">Hi (<a href="https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&_trksid=m570.l3348">Sign in</a> to bid or buy)</noscript>
Per the HTML spec, <noscript> children are parsed as raw text when scripting is enabled and as regular markup when it is disabled. lol-html hardcodes scripting-enabled semantics (the browser-with-JS model, which is right for a rewriting proxy: browsers with JS on will never render what's inside noscript, and edits there are wasted or - worse - can double-affect content mirrored outside it). This engine follows AngleSharp's scripting-off default and tokenizes inside noscript.
Both are defensible; neither is a bug. scripts/bench-sweep.ps1 currently tolerates a <=1% cross-engine edit-count difference for rewrite workloads because of this.
Proposal
Add an opt-in scripting-enabled mode to the standalone streaming path that treats <noscript> like the other inferred raw-text elements (FinishTagCore already infers text modes for <title>, <textarea>, <plaintext> etc. via compact keys when IsModeControlledExternally is false; noscript would join that set behind the flag). Default stays scripting-off to match AngleSharp.
Open questions:
- Where the flag lives: the streaming path has no options type today (only
HtmlStreamingLimits), so this either grows a small options record or a tokenizer constructor flag surfaced through QueryPlan entry points.
- The DOM-construction path should honor the same flag for consistency (AngleSharp's
IsScripting option is the natural bridge).
Acceptance
- With the flag on, selector matches and rewrite edits inside
<noscript> do not occur, and the generic-selector sweep validates lol-html edit counts exactly (tolerance in bench-sweep.ps1 can be removed or tightened).
- With the flag off (default), behavior is unchanged.
🤖 Generated with Claude Code
Context
Cross-engine validation of the generic-selector rewrite sweep (
a[href], PR #67 follow-up) found a one-anchor edit-count difference on ebay.html: this engine edits 374 anchors, lol-html edits 373. The divergent anchor sits inside<noscript>:Per the HTML spec,
<noscript>children are parsed as raw text when scripting is enabled and as regular markup when it is disabled. lol-html hardcodes scripting-enabled semantics (the browser-with-JS model, which is right for a rewriting proxy: browsers with JS on will never render what's inside noscript, and edits there are wasted or - worse - can double-affect content mirrored outside it). This engine follows AngleSharp's scripting-off default and tokenizes inside noscript.Both are defensible; neither is a bug.
scripts/bench-sweep.ps1currently tolerates a <=1% cross-engine edit-count difference for rewrite workloads because of this.Proposal
Add an opt-in scripting-enabled mode to the standalone streaming path that treats
<noscript>like the other inferred raw-text elements (FinishTagCorealready infers text modes for<title>,<textarea>,<plaintext>etc. via compact keys whenIsModeControlledExternallyis false; noscript would join that set behind the flag). Default stays scripting-off to match AngleSharp.Open questions:
HtmlStreamingLimits), so this either grows a small options record or a tokenizer constructor flag surfaced throughQueryPlanentry points.IsScriptingoption is the natural bridge).Acceptance
<noscript>do not occur, and the generic-selector sweep validates lol-html edit counts exactly (tolerance in bench-sweep.ps1 can be removed or tightened).🤖 Generated with Claude Code