diff --git a/dom.bs b/dom.bs index 7fc68016..5af3f8fc 100644 --- a/dom.bs +++ b/dom.bs @@ -5329,8 +5329,8 @@ method steps are: algorithm is passed node and oldDocument, as indicated in the adopt algorithm. -

To adopt a node into a document, run -these steps: +

To adopt a node into a document, +with an optional forceDocumentFragmentAdoption (default false):

  1. Let oldDocument be node's node document. @@ -5347,6 +5347,16 @@ these steps: shadow-including inclusive descendants:

      +
    1. +

      If forceDocumentFragmentAdoption is false, inclusiveDescendant is a + {{DocumentFragment}} node, inclusiveDescendant is node, and + node's host is non-null, then + continue. + +

      This is only reasonable as long as all adopt callers remove the children + of node. HTML's <{template}> element passes true for + forceDocumentFragmentAdoption. +

    2. Set inclusiveDescendant's node document to document.

    3. If inclusiveDescendant is an element, then set the @@ -5375,6 +5385,12 @@ these steps:

    4. If node is a shadow root, then throw a "{{HierarchyRequestError!!exception}}" {{DOMException}}. +

    5. +

      If node is a {{DocumentFragment}} node and its + host is non-null, then return node. + +

      Unfortunately this does not throw for web compatibility. +

    6. Adopt node into this.

    7. Return node.