From c8a2119a735cad38a659c3adb1849e5e2bafcd51 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Sun, 19 Jul 2026 16:53:59 +0200 Subject: [PATCH 1/2] Test the adoption agency when script reparents nodes during parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The adoption agency algorithm moves existing nodes (the furthest block and its ancestors up to the common ancestor), assuming the DOM tree still matches the stack of open elements. An inline + + + + diff --git a/html/syntax/parsing/adoption-agency-reparenting-inner-loop-cycle.html b/html/syntax/parsing/adoption-agency-reparenting-inner-loop-cycle.html new file mode 100644 index 00000000000000..0f6bc78bb7250c --- /dev/null +++ b/html/syntax/parsing/adoption-agency-reparenting-inner-loop-cycle.html @@ -0,0 +1,26 @@ + + +Adoption agency: cycle after an inner-loop iteration + + + + + + diff --git a/html/syntax/parsing/adoption-agency-reparenting.html b/html/syntax/parsing/adoption-agency-reparenting.html new file mode 100644 index 00000000000000..71ed2cd94376c5 --- /dev/null +++ b/html/syntax/parsing/adoption-agency-reparenting.html @@ -0,0 +1,70 @@ + + +Adoption agency with nodes reparented by script during parsing + + + + + + diff --git a/html/syntax/parsing/resources/adoption-agency-reparenting.js b/html/syntax/parsing/resources/adoption-agency-reparenting.js new file mode 100644 index 00000000000000..434d29695eb6b0 --- /dev/null +++ b/html/syntax/parsing/resources/adoption-agency-reparenting.js @@ -0,0 +1,32 @@ +"use strict"; + +// Shared helpers for the adoption-agency-reparenting tests. + +// Compact serializer: element -> [#id][children]; text -> "data". +// + + + + diff --git a/html/syntax/parsing/adoption-agency-reparenting-shadow-cycle.html b/html/syntax/parsing/adoption-agency-reparenting-shadow-cycle.html new file mode 100644 index 00000000000000..c22b684cea802b --- /dev/null +++ b/html/syntax/parsing/adoption-agency-reparenting-shadow-cycle.html @@ -0,0 +1,26 @@ + + +Adoption agency: host-including (shadow-crossing) cycle + + + + + + diff --git a/html/syntax/parsing/adoption-agency-reparenting-template-cycle.html b/html/syntax/parsing/adoption-agency-reparenting-template-cycle.html new file mode 100644 index 00000000000000..bf670cd1b7fe26 --- /dev/null +++ b/html/syntax/parsing/adoption-agency-reparenting-template-cycle.html @@ -0,0 +1,29 @@ + + +Adoption agency: host-including cycle via a template's contents + + + + + +