From 858fa1e0e76bd172085aeaecc28fd948e440a842 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 26 Nov 2025 08:24:15 +0100 Subject: [PATCH] Editorial: make adopt traverse the tree less --- dom.bs | 75 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/dom.bs b/dom.bs index 3574b5fd..822da482 100644 --- a/dom.bs +++ b/dom.bs @@ -6026,57 +6026,50 @@ algorithm is passed node and oldDocument, as node.
  • -

    If document is not oldDocument: +

    If document is not oldDocument, then for each + inclusiveDescendant of node's shadow-including inclusive descendants, + in shadow-including tree order:

      -
    1. -

      For each inclusiveDescendant of node's - shadow-including inclusive descendants, in shadow-including tree order: - -

        -
      1. Set inclusiveDescendant's node document to document. +

      2. Set inclusiveDescendant's node document to document. -

      3. -

        If inclusiveDescendant is a shadow root and if any of the following - are true: +

      4. +

        If inclusiveDescendant is a shadow root and if any of the following + are true: -

        -

        then set inclusiveDescendant's custom element registry to - document's effective global custom element registry. +

        then set inclusiveDescendant's custom element registry to + document's effective global custom element registry. -

      5. -

        Otherwise, if inclusiveDescendant is an element: +

      6. +

        Otherwise, if inclusiveDescendant is an element: -

          -
        1. Set the node document of each attribute in - inclusiveDescendant's attribute list to document. - -

        2. If inclusiveDescendant's custom element registry is null - or inclusiveDescendant's custom element registry's - is scoped is false, then set - inclusiveDescendant's custom element registry to - document's effective global custom element registry. -

        +
          +
        1. Set the node document of each attribute in + inclusiveDescendant's attribute list to document. + +

        2. If inclusiveDescendant's custom element registry is null + or inclusiveDescendant's custom element registry's + is scoped is false, then set + inclusiveDescendant's custom element registry to + document's effective global custom element registry. + +

        3. If inclusiveDescendant is custom, then + enqueue a custom element callback reaction with inclusiveDescendant, callback + name "adoptedCallback", and « oldDocument, document ». +

        -
      7. For each inclusiveDescendant of node's - shadow-including inclusive descendants that is custom, in - shadow-including tree order: enqueue a custom element callback reaction with - inclusiveDescendant, callback name "adoptedCallback", and - « oldDocument, document ». - - -

      8. For each inclusiveDescendant of node's - shadow-including inclusive descendants, in shadow-including tree order: run the - adopting steps with inclusiveDescendant and oldDocument. +

      9. Run the adopting steps with inclusiveDescendant and + oldDocument.