LibWeb: Complete Rust HTML tree construction

Finish the Rust implementation of the spec tree-construction algorithms
needed by the LibWeb test suite. Add the remaining table modes, foster
parenting, scope helpers, adoption agency handling, ruby/list/form and
select cases, frameset state, foreign-content edge cases, and parser
host callbacks.

Preserve behavior that depends on the C++ DOM integration, including
parser-created custom element reactions, fragment quirks mode, arbitrary
fragment namespaces, template fragment mode, fragment form ownership,
MathML annotation-xml boundaries, contextual fragment scripts, parser
script source positions, document.close() parser state, void-element
insertion, and duplicate attribute tracking.

Add focused tests for the parser edge cases that are easy to regress at
the boundary between the Rust tree builder and the C++ DOM host.
This commit is contained in:
Andreas Kling 2026-05-15 21:56:35 +02:00 committed by Andreas Kling
parent de12062515
commit 54879bc916
Notes: github-actions[bot] 2026-05-17 13:37:32 +00:00
26 changed files with 3402 additions and 361 deletions

View file

@ -201,6 +201,11 @@ void HTMLScriptElement::execute_script()
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script
void HTMLScriptElement::prepare_script()
{
// AD-HOC: Don't prepare scripts while in the temporary document used for fragment parsing. They will be prepared
// when inserted into a real document, unless fragment parsing already marked them as already started.
if (document().is_temporary_document_for_fragment_parsing())
return;
// 1. If el's already started is true, then return.
if (m_already_started)
return;