diff --git a/dom.bs b/dom.bs index a0aa0c3d2..f472a3b3c 100644 --- a/dom.bs +++ b/dom.bs @@ -52,9 +52,11 @@ spec:html; type:element

This specification depends on the Infra Standard. [[!INFRA]]

Some of the terms used in this specification are defined in Encoding, -Selectors, Web IDL, XML, and Namespaces in XML. +Selectors, Trusted Types, Web IDL, XML, and +Namespaces in XML. [[!ENCODING]] [[!SELECTORS4]] +[[!TRUSTED-TYPES]] [[!WEBIDL]] [[!XML]] [[!XML-NAMES]] @@ -3033,8 +3035,9 @@ standards that want to define APIs shared between documents and

Mixin {{ParentNode}}

-

To convert nodes into a node, given -nodes and document, run these steps: +

To convert nodes into a node, given a +node parent, list of nodes nodes, and +document document:

  1. Let node be null. @@ -3043,12 +3046,37 @@ standards that want to define APIs shared between documents and data is the string and node document is document. -

  2. If nodes contains one node, then set node to - nodes[0]. +

  3. Let isScriptElement be true if parent is an {{HTMLScriptElement}} + node; otherwise false. + +

  4. Let newNodes be « ». + +

  5. +

    For each value of nodes: + +

      +
    1. Let newValue be value. + +

    2. If value is a {{Text}} node and isScriptElement is + true, then set newValue to a new {{Text}} node whose + node document is document and data is the + result of calling Get Trusted Type compliant string, with {{TrustedScript}}, + document's relevant global object, value's + data, "HTMLScriptElement text", and "script". + +

    3. If value is a {{TrustedScript}}, then set newValue to a new {{Text}} + node whose data is value's + data and node document is document. + +

    4. Append newValue to newNodes. +

    + +
  6. If newNodes contains one node, then set node to + newNodes[0].

  7. Otherwise, set node to a new {{DocumentFragment}} node whose node document is document, and then append each node - in nodes, if any, to it. + in newNodes, if any, to it.

  8. Return node.

@@ -3060,9 +3088,9 @@ interface mixin ParentNode { readonly attribute Element? lastElementChild; readonly attribute unsigned long childElementCount; - [CEReactions, Unscopable] undefined prepend((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined append((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined replaceChildren((Node or DOMString)... nodes); + [CEReactions, Unscopable] undefined prepend((Node or TrustedScript or DOMString)... nodes); + [CEReactions, Unscopable] undefined append((Node or TrustedScript or DOMString)... nodes); + [CEReactions, Unscopable] undefined replaceChildren((Node or TrustedScript or DOMString)... nodes); Element? querySelector(DOMString selectors); [NewObject] NodeList querySelectorAll(DOMString selectors); @@ -3136,8 +3164,8 @@ the number of children of this that are elements

The prepend(nodes) method steps are:

    -
  1. Let node be the result of converting nodes into a node given - nodes and this's node document. +

  2. Let node be the result of converting nodes into a node given this, + nodes, and this's node document.

  3. Pre-insert node into this before this's first child. @@ -3146,8 +3174,8 @@ the number of children of this that are elements

    The append(nodes) method steps are:

      -
    1. Let node be the result of converting nodes into a node given - nodes and this's node document. +

    2. Let node be the result of converting nodes into a node given this, + nodes, and this's node document.

    3. Append node to this.

    @@ -3156,8 +3184,8 @@ the number of children of this that are elements are:
      -
    1. Let node be the result of converting nodes into a node given - nodes and this's node document. +

    2. Let node be the result of converting nodes into a node given this, + nodes, and this's node document.

    3. Ensure pre-insertion validity of node into this before null. @@ -3212,9 +3240,9 @@ steps are to return the first following sibling that is a

       interface mixin ChildNode {
      -  [CEReactions, Unscopable] undefined before((Node or DOMString)... nodes);
      -  [CEReactions, Unscopable] undefined after((Node or DOMString)... nodes);
      -  [CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes);
      +  [CEReactions, Unscopable] undefined before((Node or TrustedScript or DOMString)... nodes);
      +  [CEReactions, Unscopable] undefined after((Node or TrustedScript or DOMString)... nodes);
      +  [CEReactions, Unscopable] undefined replaceWith((Node or TrustedScript or DOMString)... nodes);
         [CEReactions, Unscopable] undefined remove();
       };
       DocumentType includes ChildNode;
      @@ -3262,7 +3290,7 @@ CharacterData includes ChildNode;
        sibling not in nodes; otherwise null.
       
        
    4. Let node be the result of converting nodes into a node, given - nodes and this's node document. + parent, nodes, and this's node document.

    5. If viablePreviousSibling is null, then set it to parent's first child; otherwise to viablePreviousSibling's @@ -3283,7 +3311,7 @@ CharacterData includes ChildNode; sibling not in nodes; otherwise null.

    6. Let node be the result of converting nodes into a node, given - nodes and this's node document. + parent, nodes, and this's node document.

    7. Pre-insert node into parent before viableNextSibling. @@ -3300,7 +3328,7 @@ CharacterData includes ChildNode; sibling not in nodes; otherwise null.

    8. Let node be the result of converting nodes into a node, given - nodes and this's node document. + parent, nodes, and this's node document.

    9. If this's parent is parent, replace this with