html5ever icon indicating copy to clipboard operation
html5ever copied to clipboard

`tokenizer_state_for_context_elem` should use scripting flag of the context element, not the parser

Open simonwuelker opened this issue 8 months ago • 1 comments

When determining the initial tokenizer state during fragment parsing for a noscript element we should use the scripting flag of the noscript element, not that of the fragment parser. Scripting is always disabled in the fragment parsing case, because the DocumentFragment never has a browsing context.

https://github.com/servo/html5ever/blob/6b3601add6f18389092759b3069c5facce6a7912/html5ever/src/tree_builder/mod.rs#L252-L258

This causes a failure in /html/syntax/parsing-html-fragments/tokenizer-modes-001.html.

For context, see https://github.com/servo/servo/pull/35848.

simonwuelker avatar Mar 09 '25 14:03 simonwuelker

We always set the parser's scripting flag to true, which probably has an impact here.

jdm avatar Mar 09 '25 15:03 jdm