From 184fbb30011fa617e52e028219d345d11d8acbce Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Tue, 23 Jan 2024 17:06:06 +0100 Subject: [PATCH 01/23] Draft integration with Trusted Types, take 2. See https://github.com/w3c/trusted-types/pull/418 and #789. Supercedes PR #809. --- dom.bs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index a5f9b88c..8d3f74de 100644 --- a/dom.bs +++ b/dom.bs @@ -6133,8 +6133,8 @@ interface Element : Node { sequence<DOMString> getAttributeNames(); DOMString? getAttribute(DOMString qualifiedName); DOMString? getAttributeNS(DOMString? namespace, DOMString localName); - [CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value); - [CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value); + [CEReactions] undefined setAttribute(DOMString qualifiedName, (TrustedType or DOMString) value); + [CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, (TrustedType or DOMString) value); [CEReactions] undefined removeAttribute(DOMString qualifiedName); [CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName); [CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force); @@ -6456,6 +6456,10 @@ given a document, localName, namespace, and opt attribute attribute to value, run these steps:
    +
  1. Set value to the result of calling Get Trusted Types-compliant attribute + value for attribute, with attribute's element and + value. [[!TRUSTED-TYPES]] +

  2. Let oldValue be attribute's value.

  3. Set attribute's value to value. @@ -6469,6 +6473,11 @@ given a document, localName, namespace, and opt steps:

      +
    1. Set attribute's + value to the result of calling Get Trusted Types-compliant attribute value + for attribute, with element and attribute's value. + [[!TRUSTED-TYPES]] +

    2. Append attribute to element's attribute list. @@ -6497,6 +6506,11 @@ steps: attribute oldAttr with an attribute newAttr, run these steps:

        +
      1. Set newAttr's + value to the result of calling Get Trusted Types-compliant attribute value + for newAttr, with oldAttr's element and newAttr's + value.[[!TRUSTED-TYPES]] +

      2. Replace oldAttr by newAttr in oldAttr's element's attribute list. @@ -6583,7 +6597,7 @@ string namespace (default null):

        To set an attribute value given an -element element, a string localName, a string value, +element element, a string localName, a string or TrustedType value, an optional null or string prefix (default null), and an optional null or string namespace (default null): @@ -6594,7 +6608,7 @@ an optional null or string prefix (default null), and an optional nul

      3. If attribute is null, create an attribute whose namespace is namespace, namespace prefix is prefix, - local name is localName, value is value, and + local name is localName, value is stringified value, and node document is element's node document, then append this attribute to element, and then return. @@ -6862,7 +6876,7 @@ method steps are:
      4. If attribute is null, create an attribute whose local name is qualifiedName, value is - value, and node document is this's node document, + stringified value, and node document is this's node document, then append this attribute to this, and then return.

      5. Change attribute to value. From ebae0eaa0c41245f9f653f93341b1545f081baf6 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Wed, 24 Jan 2024 17:05:14 +0100 Subject: [PATCH 02/23] Added integration in 'set an attribute value'. --- dom.bs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index 8d3f74de..f1c16ab7 100644 --- a/dom.bs +++ b/dom.bs @@ -6606,12 +6606,27 @@ an optional null or string prefix (default null), and an optional nul getting an attribute given namespace, localName, and element. -

      6. If attribute is null, create an attribute whose namespace is - namespace, namespace prefix is prefix, - local name is localName, value is stringified value, and - node document is element's node document, then - append this attribute to element, and then - return. +
      7. If attribute is null, then: + +

          +
        1. Set attribute to a new attribute whose namespace is + namespace, namespace prefix is prefix, + local name is localName and + node document is element's node document. + +

        2. Set attribute's value to the result of calling Get Trusted Types-compliant attribute + value for attribute, with element and + value. [[!TRUSTED-TYPES]] + +

        3. Append attribute to element's + attribute list. + +

        4. Set attribute's element to element. + +

        5. Handle attribute changes for attribute with element, null, and + attribute's value. +

        6. Return. +

      8. Change attribute to value.

      From 3dc6eba38133bd6443a92f0750289e66ff49abcc Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Wed, 24 Jan 2024 17:59:03 +0100 Subject: [PATCH 03/23] Removed stringification. --- dom.bs | 59 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/dom.bs b/dom.bs index f1c16ab7..0e527bf4 100644 --- a/dom.bs +++ b/dom.bs @@ -6456,13 +6456,9 @@ given a document, localName, namespace, and opt attribute attribute to value, run these steps:
        -
      1. Set value to the result of calling Get Trusted Types-compliant attribute - value for attribute, with attribute's element and - value. [[!TRUSTED-TYPES]] -

      2. Let oldValue be attribute's value.

      3. -
      4. Set attribute's value to value. +

      5. Validate and set attribute value value for attribute, with attribute's element.

      6. Handle attribute changes for attribute with attribute's element, oldValue, and value. @@ -6473,11 +6469,6 @@ given a document, localName, namespace, and opt steps:

          -
        1. Set attribute's - value to the result of calling Get Trusted Types-compliant attribute value - for attribute, with element and attribute's value. - [[!TRUSTED-TYPES]] -

        2. Append attribute to element's attribute list. @@ -6506,11 +6497,6 @@ steps: attribute oldAttr with an attribute newAttr, run these steps:

            -
          1. Set newAttr's - value to the result of calling Get Trusted Types-compliant attribute value - for newAttr, with oldAttr's element and newAttr's - value.[[!TRUSTED-TYPES]] -

          2. Replace oldAttr by newAttr in oldAttr's element's attribute list. @@ -6524,6 +6510,14 @@ steps: value.

          +

          To validate and set attribute value value for an attribute attribute, with element element, run these steps: + +

            +
          1. Let validValue be the result of calling Get Trusted Types-compliant attribute value + for attribute, with element and value.[[!TRUSTED-TYPES]] +

          2. Set attribute's value to validValue. +

          +
          @@ -6586,6 +6580,8 @@ string namespace (default null):

        3. If oldAttr is attr, return attr. +

        4. Validate and set attribute value newAttr's value for newAttr with element. +

        5. If oldAttr is non-null, then replace oldAttr with attr. @@ -6606,7 +6602,12 @@ an optional null or string prefix (default null), and an optional nul getting an attribute given namespace, localName, and element. -

        6. If attribute is null, then: +

        7. If attribute is null, create an attribute whose namespace is + namespace, namespace prefix is prefix, + local name is localName, value is value, and + node document is element's node document, then + append this attribute to element, and then + return.
          1. Set attribute to a new attribute whose namespace is @@ -6614,18 +6615,10 @@ an optional null or string prefix (default null), and an optional nul local name is localName and node document is element's node document. -

          2. Set attribute's value to the result of calling Get Trusted Types-compliant attribute - value for attribute, with element and - value. [[!TRUSTED-TYPES]] +

          3. Validate and set attribute value value for attribute with element. -

          4. Append attribute to element's - attribute list. - -

          5. Set attribute's element to element. - -

          6. Handle attribute changes for attribute with element, null, and - attribute's value. -

          7. Return. +

          8. Append attribute to element +

          9. Return.

        8. Change attribute to value. @@ -6889,10 +6882,14 @@ method steps are: and null otherwise. -

        9. If attribute is null, create an attribute whose - local name is qualifiedName, value is - stringified value, and node document is this's node document, - then append this attribute to this, and then return. +

        10. If attribute is null, then: +

            +
          1. Set attribute to a new attribute whose + local name is qualifiedName and node document is this's node document. +

          2. Validate and set attribute value value for attribute, with this. +

          3. Append attribute to this. +
          4. Return. +

        11. Change attribute to value.

        From f88ea294bf90f4b376e7a960089c45a7fddad152 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Thu, 25 Jan 2024 12:08:40 +0100 Subject: [PATCH 04/23] Fixed formatting. --- dom.bs | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/dom.bs b/dom.bs index 0e527bf4..a1383b4e 100644 --- a/dom.bs +++ b/dom.bs @@ -6458,7 +6458,8 @@ given a document, localName, namespace, and opt
        1. Let oldValue be attribute's value.

        2. -
        3. Validate and set attribute value value for attribute, with attribute's element. +

        4. Validate and set attribute value value for attribute, with + attribute's element.

        5. Handle attribute changes for attribute with attribute's element, oldValue, and value. @@ -6510,13 +6511,17 @@ steps: value.

        -

        To validate and set attribute value value for an attribute attribute, with element element, run these steps: +

        To validate and set attribute value +value for an attribute attribute, with element +element, run these steps: + +

          +
        1. Let validValue be the result of calling + Get Trusted Types-compliant attribute value for attribute, with + element and value. [[!TRUSTED-TYPES]] -

            -
          1. Let validValue be the result of calling Get Trusted Types-compliant attribute value - for attribute, with element and value.[[!TRUSTED-TYPES]]

          2. Set attribute's value to validValue. -

          +

        @@ -6580,7 +6585,8 @@ string namespace (default null):

      7. If oldAttr is attr, return attr. -

      8. Validate and set attribute value newAttr's value for newAttr with element. +

      9. Validate and set attribute value newAttr's value for + newAttr with element.

      10. If oldAttr is non-null, then replace oldAttr with attr. @@ -6593,9 +6599,9 @@ string namespace (default null):

        To set an attribute value given an -element element, a string localName, a string or TrustedType value, -an optional null or string prefix (default null), and an optional null or string -namespace (default null): +element element, a string localName, a string or {{TrustedType}} +value, an optional null or string prefix (default null), and an optional null +or string namespace (default null):

        1. Let attribute be the result of @@ -6612,12 +6618,14 @@ an optional null or string prefix (default null), and an optional nul
          1. Set attribute to a new attribute whose namespace is namespace, namespace prefix is prefix, - local name is localName and - node document is element's node document. + local name is localName and node document is + element's node document. + +

          2. Validate and set attribute value value for attribute with + element. -

          3. Validate and set attribute value value for attribute with element. +

          4. Append attribute to element. -

          5. Append attribute to element

          6. Return.

          @@ -6883,13 +6891,19 @@ method steps are:
        2. If attribute is null, then: -

            -
          1. Set attribute to a new attribute whose - local name is qualifiedName and node document is this's node document. -

          2. Validate and set attribute value value for attribute, with this. -

          3. Append attribute to this. -
          4. Return. -

          + +
            +
          1. Set attribute to a new attribute whose local name is + qualifiedName and node document is this's + node document. + +

          2. Validate and set attribute value value for attribute, + with this. + +

          3. Append attribute to this. + +

          4. Return. +

        3. Change attribute to value.

        From 966291ff310bfa7da8152eaec977ce2b9519e1f8 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Thu, 25 Jan 2024 15:09:01 +0100 Subject: [PATCH 05/23] Fixed copy-paste error in setAttribute() and indentation. --- dom.bs | 54 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/dom.bs b/dom.bs index a1383b4e..1d8cbd46 100644 --- a/dom.bs +++ b/dom.bs @@ -6512,8 +6512,8 @@ steps:

      To validate and set attribute value -value for an attribute attribute, with element -element, run these steps: +{{TrustedType}} or a string value for an attribute attribute, with +element element:

      1. Let validValue be the result of calling @@ -6608,26 +6608,21 @@ or string namespace (default null): getting an attribute given namespace, localName, and element. -

      2. If attribute is null, create an attribute whose namespace is - namespace, namespace prefix is prefix, - local name is localName, value is value, and - node document is element's node document, then - append this attribute to element, and then - return. - -
          -
        1. Set attribute to a new attribute whose namespace is - namespace, namespace prefix is prefix, - local name is localName and node document is - element's node document. +

        2. +

          If attribute is null, then: +

            +
          1. Set attribute to a new attribute whose namespace is + namespace, namespace prefix is prefix, + local name is localName and node document is + element's node document. -

          2. Validate and set attribute value value for attribute with - element. +

          3. Validate and set attribute value value for attribute with + element. -

          4. Append attribute to element. +

          5. Append attribute to element. -

          6. Return. -

          +
        3. Return. +

      3. Change attribute to value.

      @@ -6890,20 +6885,21 @@ method steps are: and null otherwise. -
    3. If attribute is null, then: +

    4. +

      If attribute is null, then: -

        -
      1. Set attribute to a new attribute whose local name is - qualifiedName and node document is this's - node document. +

          +
        1. Set attribute to a new attribute whose local name is + qualifiedName and node document is this's + node document. -

        2. Validate and set attribute value value for attribute, - with this. +

        3. Validate and set attribute value value for attribute, + with this. -

        4. Append attribute to this. +

        5. Append attribute to this. -

        6. Return. -

        +
      2. Return. +

    5. Change attribute to value.

    From 065ee2e99d4949e71ee9e5aa1abe74b4e744d89a Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 28 Mar 2024 10:54:57 +0000 Subject: [PATCH 06/23] Fix build --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 1d8cbd46..2a7090a0 100644 --- a/dom.bs +++ b/dom.bs @@ -6517,7 +6517,7 @@ steps:
    1. Let validValue be the result of calling - Get Trusted Types-compliant attribute value for attribute, with + get Trusted Types-compliant attribute value for attribute, with element and value. [[!TRUSTED-TYPES]]

    2. Set attribute's value to validValue. From 19e8f5459d46a80a0bdda575f43b00fe7d8c2555 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 28 Mar 2024 11:52:58 +0000 Subject: [PATCH 07/23] Change code to pass sink values through to TT code. --- dom.bs | 63 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/dom.bs b/dom.bs index 2a7090a0..8122f747 100644 --- a/dom.bs +++ b/dom.bs @@ -4364,7 +4364,7 @@ empty string instead, and then do as described below, switching on the interface

      {{Attr}} -

      Set an existing attribute value with this and the given value. +

      Set an existing attribute value with this, the given value, and "Node nodeValue".

      {{CharacterData}}

      Replace data with node this, offset 0, count this's @@ -4417,7 +4417,8 @@ do as defined below, switching on the interface node implements

      String replace all with value within node.

      {{Attr}} -

      Set an existing attribute value with node and value. +

      Set an existing attribute value with node, value and + "Node textContent".

      {{CharacterData}}

      Replace data with node node, offset 0, count node's @@ -6453,13 +6454,13 @@ given a document, localName, namespace, and opt

    To change an -attribute attribute to value, run these steps: +attribute attribute to value, with string sink, run these steps:

    1. Let oldValue be attribute's value.

    2. Validate and set attribute value value for attribute, with - attribute's element. + attribute's element, and sink.

    3. Handle attribute changes for attribute with attribute's element, oldValue, and value. @@ -6513,12 +6514,12 @@ steps:

      To validate and set attribute value {{TrustedType}} or a string value for an attribute attribute, with -element element: +element element, and string sink:

      1. Let validValue be the result of calling get Trusted Types-compliant attribute value for attribute, with - element and value. [[!TRUSTED-TYPES]] + element, value, and sink. [[!TRUSTED-TYPES]]

      2. Set attribute's value to validValue.

      @@ -6572,7 +6573,8 @@ string namespace (default null):

      To set an attribute given an -attribute attr and an element element: +attribute attr, an element element, +and a string sink:

      1. If attr's element is neither null nor element, @@ -6586,7 +6588,7 @@ string namespace (default null):

      2. If oldAttr is attr, return attr.

      3. Validate and set attribute value newAttr's value for - newAttr with element. + newAttr with element, and sink.

      4. If oldAttr is non-null, then replace oldAttr with attr. @@ -6600,8 +6602,8 @@ string namespace (default null):

        To set an attribute value given an element element, a string localName, a string or {{TrustedType}} -value, an optional null or string prefix (default null), and an optional null -or string namespace (default null): +value, an optional null or string prefix (default null), an optional null +or string namespace (default null), and an optional string sink (default ""):

        1. Let attribute be the result of @@ -6617,14 +6619,14 @@ or string namespace (default null): element's node document.
        2. Validate and set attribute value value for attribute with - element. + element, and sink.

        3. Append attribute to element.

        4. Return.

        -
      5. Change attribute to value. +

      6. Change attribute to value, with sink.

      @@ -6894,14 +6896,14 @@ method steps are: node document.
    4. Validate and set attribute value value for attribute, - with this. + with this and "Element setAttribute".

    5. Append attribute to this.

    6. Return.

    -
  4. Change attribute to value. +

  5. Change attribute to value, with "Element setAttribute".

The @@ -6913,7 +6915,7 @@ method steps are: passing namespace and qualifiedName to validate and extract.

  • Set an attribute value for this using localName, value, - and also prefix and namespace. + and also prefix and namespace, and "Element setAttributeNS".

    The @@ -6999,10 +7001,13 @@ method steps are to return the result of getting an attribute given namespace, localName, and this. -

    The setAttributeNode(attr) and -setAttributeNodeNS(attr) methods steps are to +

    The setAttributeNode(attr) methods steps are to return the result of setting an attribute given attr and -this. +this, and "Element setAttributeNode". + +

    The setAttributeNodeNS(attr) methods steps are to +return the result of setting an attribute given attr, +this, and "Element setAttributeNodeNS".

    The removeAttributeNode(attr) method steps are: @@ -7357,10 +7362,13 @@ method steps are to return the result of getting an attribute given namespace, localName, and element. -

    The setNamedItem(attr) and -setNamedItemNS(attr) method steps are -to return the result of setting an attribute given attr and -element. +

    The setNamedItem(attr) method steps are +to return the result of setting an attribute given attr, +element, and "NamedNodeMap setNamedItem". + +

    The setNamedItemNS(attr) method steps are +to return the result of setting an attribute given attr, +element, and "NamedNodeMap setNamedItemNS".

    The removeNamedItem(qualifiedName) method steps are: @@ -7464,18 +7472,19 @@ null.

    The value getter steps are to return this's value. -

    To set an existing attribute value, given an attribute attribute and -string value, run these steps: +

    To set an existing attribute value, given an attribute attribute, +string value, and string sink, run these steps:

    1. If attribute's element is null, then set attribute's value to value. -

    2. Otherwise, change attribute to value. +

    3. Otherwise, change attribute to value, + with sink.

    -

    The {{Attr/value}} setter steps are to set an existing attribute value with this -and the given value. +

    The {{Attr/value}} setter steps are to set an existing attribute value with this, +the given value, and "Attr value".


    From 964b8cd8d8c07434537a1aeb5c6eec2c60fa932f Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Wed, 10 Apr 2024 16:43:01 +0100 Subject: [PATCH 08/23] Move validate and set attribute into append an attribute --- dom.bs | 68 +++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/dom.bs b/dom.bs index 8122f747..9e15d030 100644 --- a/dom.bs +++ b/dom.bs @@ -6467,10 +6467,14 @@ given a document, localName, namespace, and opt

    To append an -attribute attribute to an element element, run these -steps: +attribute attribute to an element element, with optional +string sink (default ""), run these steps:

      +
    1. If sink is not an empty string Validate and set attribute value + attribute's value for attribute with element, + and sink. +

    2. Append attribute to element's attribute list. @@ -6587,13 +6591,18 @@ and a string sink:

    3. If oldAttr is attr, return attr. -

    4. Validate and set attribute value newAttr's value for - newAttr with element, and sink. +

    5. +

      If oldAttr is non-null, then:

      -
    6. If oldAttr is non-null, then replace - oldAttr with attr. +

      + +
    7. Otherwise, append attr to element + with sink.

    8. Return oldAttr.

    @@ -6610,21 +6619,12 @@ or string namespace (default null), and an optional string sink< getting an attribute given namespace, localName, and element. -
  • -

    If attribute is null, then: -

      -
    1. Set attribute to a new attribute whose namespace is - namespace, namespace prefix is prefix, - local name is localName and node document is - element's node document. - -

    2. Validate and set attribute value value for attribute with - element, and sink. - -

    3. Append attribute to element. - -

    4. Return. -

    +
  • If attribute is null, create an attribute whose namespace is + namespace, namespace prefix is prefix, + local name is localName, value is value, and + node document is element's node document, then + append this attribute to element with + sink, and then return.
  • Change attribute to value, with sink. @@ -6887,21 +6887,11 @@ method steps are: and null otherwise. -

  • -

    If attribute is null, then: - -

      -
    1. Set attribute to a new attribute whose local name is - qualifiedName and node document is this's - node document. - -

    2. Validate and set attribute value value for attribute, - with this and "Element setAttribute". - -

    3. Append attribute to this. - -

    4. Return. -

    +
  • If attribute is null, create an attribute whose + local name is qualifiedName, value is + value, and node document is this's node document, + then append this attribute to this with + "Element setAttribute", and then return.

  • Change attribute to value, with "Element setAttribute". @@ -6964,8 +6954,8 @@ method steps are:

  • If force is not given or is true, create an attribute whose local name is qualifiedName, value is the empty string, and node document is this's node document, then - append this attribute to this, and then return - true. + append this attribute to this with + "Element toggleAttribute", and then return true.

  • Return false. From 8db6d267ddf934d020e868d11bad532956d09787 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 11 Apr 2024 13:12:42 +0100 Subject: [PATCH 09/23] Remove sink values from spec --- dom.bs | 89 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/dom.bs b/dom.bs index 9e15d030..78acfa1b 100644 --- a/dom.bs +++ b/dom.bs @@ -4364,7 +4364,7 @@ empty string instead, and then do as described below, switching on the interface

    {{Attr}} -

    Set an existing attribute value with this, the given value, and "Node nodeValue". +

    Set an existing attribute value with this, the given value.

    {{CharacterData}}

    Replace data with node this, offset 0, count this's @@ -4417,8 +4417,7 @@ do as defined below, switching on the interface node implements

    String replace all with value within node.

    {{Attr}} -

    Set an existing attribute value with node, value and - "Node textContent". +

    Set an existing attribute value with node, value.

    {{CharacterData}}

    Replace data with node node, offset 0, count node's @@ -4541,7 +4540,8 @@ dom-Range-extractContents, dom-Range-cloneContents -->

    1. Let copyAttribute be a clone of attribute. -

    2. Append copyAttribute to copy. +

    3. Append copyAttribute to copy, + with false.

  • @@ -6454,26 +6454,36 @@ given a document, localName, namespace, and opt

    To change an -attribute attribute to value, with string sink, run these steps: +attribute attribute to value, run these steps:

    1. Let oldValue be attribute's value.

    2. Validate and set attribute value value for attribute, with - attribute's element, and sink. + attribute's element. -

    3. Handle attribute changes for attribute with attribute's - element, oldValue, and value. +

    4. If attribute's element has + an attribute attribute, then handle attribute changes for + attribute with attribute's element, oldValue, and + value. + +

    5. Otherwise, throw an "{{InvalidStateError!!exception}}" {{DOMException}}.

    To append an attribute attribute to an element element, with optional -string sink (default ""), run these steps: +boolean validate (default true), run these steps:

      -
    1. If sink is not an empty string Validate and set attribute value - attribute's value for attribute with element, - and sink. +

    2. +

      If validate, then: +

        +
      1. Validate and set attribute value + attribute's value for attribute with element. + +

      2. If element has an attribute + attribute, then throw an "{{InvalidStateError!!exception}}" {{DOMException}}. +

    3. Append attribute to element's attribute list. @@ -6518,12 +6528,12 @@ string sink (default ""), run these steps:

      To validate and set attribute value {{TrustedType}} or a string value for an attribute attribute, with -element element, and string sink: +element element:

      1. Let validValue be the result of calling get Trusted Types-compliant attribute value for attribute, with - element, value, and sink. [[!TRUSTED-TYPES]] + element, value. [[!TRUSTED-TYPES]]

      2. Set attribute's value to validValue.

      @@ -6577,8 +6587,7 @@ string namespace (default null):

      To set an attribute given an -attribute attr, an element element, -and a string sink: +attribute attr, an element element.

      1. If attr's element is neither null nor element, @@ -6596,13 +6605,16 @@ and a string sink:

        -
      2. Otherwise, append attr to element - with sink. +

      3. Otherwise, append attr to element.

      4. Return oldAttr.

      @@ -6612,7 +6624,7 @@ and a string sink:

      To set an attribute value given an element element, a string localName, a string or {{TrustedType}} value, an optional null or string prefix (default null), an optional null -or string namespace (default null), and an optional string sink (default ""): +or string namespace (default null):

      1. Let attribute be the result of @@ -6623,10 +6635,9 @@ or string namespace (default null), and an optional string sink< namespace, namespace prefix is prefix, local name is localName, value is value, and node document is element's node document, then - append this attribute to element with - sink, and then return. + append this attribute to element, and then return. -
      2. Change attribute to value, with sink. +

      3. Change attribute to value.

      @@ -6887,13 +6898,12 @@ method steps are: and null otherwise. -
    4. If attribute is null, create an attribute whose - local name is qualifiedName, value is - value, and node document is this's node document, - then append this attribute to this with - "Element setAttribute", and then return. +

    5. If attribute is null, create an attribute whose + local name is qualifiedName, value is + value, and node document is this's node document, + then append this attribute to this, and then return. -

    6. Change attribute to value, with "Element setAttribute". +

    7. Change attribute to value.

    The @@ -6905,7 +6915,7 @@ method steps are: passing namespace and qualifiedName to validate and extract.

  • Set an attribute value for this using localName, value, - and also prefix and namespace, and "Element setAttributeNS". + and also prefix and namespace.

    The @@ -6954,8 +6964,8 @@ method steps are:

  • If force is not given or is true, create an attribute whose local name is qualifiedName, value is the empty string, and node document is this's node document, then - append this attribute to this with - "Element toggleAttribute", and then return true. + append this attribute to this, + and then return true.

  • Return false. @@ -6993,11 +7003,11 @@ method steps are to return the result of

    The setAttributeNode(attr) methods steps are to return the result of setting an attribute given attr and -this, and "Element setAttributeNode". +this.

    The setAttributeNodeNS(attr) methods steps are to return the result of setting an attribute given attr, -this, and "Element setAttributeNodeNS". +this.

    The removeAttributeNode(attr) method steps are: @@ -7354,11 +7364,11 @@ method steps are to return the result of

    The setNamedItem(attr) method steps are to return the result of setting an attribute given attr, -element, and "NamedNodeMap setNamedItem". +element.

    The setNamedItemNS(attr) method steps are to return the result of setting an attribute given attr, -element, and "NamedNodeMap setNamedItemNS". +element.

    The removeNamedItem(qualifiedName) method steps are: @@ -7463,14 +7473,13 @@ null. value.

    To set an existing attribute value, given an attribute attribute, -string value, and string sink, run these steps: +string value, run these steps:

    1. If attribute's element is null, then set attribute's value to value. -

    2. Otherwise, change attribute to value, - with sink. +

    3. Otherwise, change attribute to value.

    The {{Attr/value}} setter steps are to set an existing attribute value with this, From 271a670c79aca6d6c086bdcdd89dc5e3b033e195 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 22 Apr 2024 13:19:52 +0100 Subject: [PATCH 10/23] Revert changes to setAttributeNode and setAttributeNodeNS method steps --- dom.bs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index 78acfa1b..a96b670b 100644 --- a/dom.bs +++ b/dom.bs @@ -7001,14 +7001,11 @@ method steps are to return the result of getting an attribute given namespace, localName, and this. -

    The setAttributeNode(attr) methods steps are to +

    The setAttributeNode(attr) and +setAttributeNodeNS(attr) methods steps are to return the result of setting an attribute given attr and this. -

    The setAttributeNodeNS(attr) methods steps are to -return the result of setting an attribute given attr, -this. -

    The removeAttributeNode(attr) method steps are: From 2427ef4da418ea185bc255b4c8199a1d23c13958 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 22 Apr 2024 14:13:29 +0100 Subject: [PATCH 11/23] Remove throw from set an attribute and move TT check down to replace an attribute --- dom.bs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/dom.bs b/dom.bs index a96b670b..18c54b03 100644 --- a/dom.bs +++ b/dom.bs @@ -6513,6 +6513,9 @@ boolean validate (default true), run these steps: attribute oldAttr with an attribute newAttr, run these steps:

      +
    1. Validate and set attribute value newAttr's value for + newAttr with oldAttr's element. +

    2. Replace oldAttr by newAttr in oldAttr's element's attribute list. @@ -6598,21 +6601,8 @@ string namespace (default null):

      attr's namespace, attr's local name, and element. -
    3. If oldAttr is attr, return attr. - -

    4. -

      If oldAttr is non-null, then:

      - - +
    5. If oldAttr is non-null, then replace + oldAttr with attr.

    6. Otherwise, append attr to element. From b5de89b7c5b1f6715d685a779111122fb0975d0b Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 22 Apr 2024 16:44:45 +0100 Subject: [PATCH 12/23] Revert unneeded changes --- dom.bs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dom.bs b/dom.bs index 18c54b03..167bb3c0 100644 --- a/dom.bs +++ b/dom.bs @@ -4364,7 +4364,7 @@ empty string instead, and then do as described below, switching on the interface

      {{Attr}} -

      Set an existing attribute value with this, the given value. +

      Set an existing attribute value with this and the given value.

      {{CharacterData}}

      Replace data with node this, offset 0, count this's @@ -7349,12 +7349,9 @@ method steps are to return the result of getting an attribute given namespace, localName, and element. -

      The setNamedItem(attr) method steps are -to return the result of setting an attribute given attr, -element. - -

      The setNamedItemNS(attr) method steps are -to return the result of setting an attribute given attr, +

      The setNamedItem(attr) and +setNamedItemNS(attr) method steps are +to return the result of setting an attribute given attr and element.

      The removeNamedItem(qualifiedName) From cd0415b998aeb88fd4bf2df9cf75e70113ef4968 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 22 Apr 2024 16:44:55 +0100 Subject: [PATCH 13/23] Address comment --- dom.bs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/dom.bs b/dom.bs index 167bb3c0..69816668 100644 --- a/dom.bs +++ b/dom.bs @@ -4417,7 +4417,7 @@ do as defined below, switching on the interface node implements

      String replace all with value within node.

      {{Attr}} -

      Set an existing attribute value with node, value. +

      Set an existing attribute value with node and value.

      {{CharacterData}}

      Replace data with node node, offset 0, count node's @@ -6459,7 +6459,7 @@ given a document, localName, namespace, and opt

      1. Let oldValue be attribute's value.

      2. -
      3. Validate and set attribute value value for attribute, with +

      4. Verify and set attribute value value for attribute, with attribute's element.

      5. If attribute's element has @@ -6476,9 +6476,9 @@ boolean validate (default true), run these steps:

        1. -

          If validate, then: +

          If validate is true, then:

            -
          1. Validate and set attribute value +

          2. Verify and set attribute value attribute's value for attribute with element.

          3. If element has an attribute @@ -6513,7 +6513,7 @@ boolean validate (default true), run these steps: attribute oldAttr with an attribute newAttr, run these steps:

              -
            1. Validate and set attribute value newAttr's value for +

            2. Verify and set attribute value newAttr's value for newAttr with oldAttr's element.

            3. Replace oldAttr by newAttr in oldAttr's @@ -6529,8 +6529,8 @@ boolean validate (default true), run these steps: value.

            -

            To validate and set attribute value -{{TrustedType}} or a string value for an attribute attribute, with +

            To verify and set attribute value +{{TrustedType}} or string value for an attribute attribute, with element element:

              @@ -6590,7 +6590,7 @@ string namespace (default null):

              To set an attribute given an -attribute attr, an element element. +attribute attr and an element element:

              1. If attr's element is neither null nor element, @@ -6625,7 +6625,8 @@ or string namespace (default null): namespace, namespace prefix is prefix, local name is localName, value is value, and node document is element's node document, then - append this attribute to element, and then return. + append this attribute to element, and then + return.

              2. Change attribute to value.

              @@ -6954,8 +6955,8 @@ method steps are:
            1. If force is not given or is true, create an attribute whose local name is qualifiedName, value is the empty string, and node document is this's node document, then - append this attribute to this, - and then return true. + append this attribute to this, and then return + true.

            2. Return false.

            @@ -7456,7 +7457,7 @@ null.

            The value getter steps are to return this's value. -

            To set an existing attribute value, given an attribute attribute, +

            To set an existing attribute value, given an attribute attribute and string value, run these steps:

              @@ -7466,8 +7467,8 @@ string value, run these steps:
            1. Otherwise, change attribute to value.

            -

            The {{Attr/value}} setter steps are to set an existing attribute value with this, -the given value, and "Attr value". +

            The {{Attr/value}} setter steps are to set an existing attribute value with this +and the given value.


            From d2adea44027ab1071a6f65e0d042eea14b14fd25 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 22 Apr 2024 16:54:01 +0100 Subject: [PATCH 14/23] Add missing and --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 69816668..6aa7ea35 100644 --- a/dom.bs +++ b/dom.bs @@ -6613,7 +6613,7 @@ string namespace (default null):

            To set an attribute value given an element element, a string localName, a string or {{TrustedType}} -value, an optional null or string prefix (default null), an optional null +value, an optional null or string prefix (default null), and an optional null or string namespace (default null):

              From 99ae58546b2fe36c70386ff2ef71891006111f14 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Tue, 7 May 2024 16:39:27 +0100 Subject: [PATCH 15/23] Address some comments --- dom.bs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/dom.bs b/dom.bs index 6aa7ea35..fca37a0d 100644 --- a/dom.bs +++ b/dom.bs @@ -6462,8 +6462,8 @@ given a document, localName, namespace, and opt
            1. Verify and set attribute value value for attribute, with attribute's element. -

            2. If attribute's element has - an attribute attribute, then handle attribute changes for +

            3. If attribute's element + has an attribute, then handle attribute changes for attribute with attribute's element, oldValue, and value. @@ -6471,15 +6471,16 @@ given a document, localName, namespace, and opt

            To append an -attribute attribute to an element element, with optional -boolean validate (default true), run these steps: +attribute attribute to an element element, with an +optional boolean validate (default true):

            1. -

              If validate is true, then: +

              If validate is true: +

              1. Verify and set attribute value - attribute's value for attribute with element. + attribute's value for attribute, with element.

              2. If element has an attribute attribute, then throw an "{{InvalidStateError!!exception}}" {{DOMException}}. @@ -6514,7 +6515,7 @@ boolean validate (default true), run these steps:

                1. Verify and set attribute value newAttr's value for - newAttr with oldAttr's element. + newAttr, with oldAttr's element.

                2. Replace oldAttr by newAttr in oldAttr's element's attribute list. @@ -6529,16 +6530,16 @@ boolean validate (default true), run these steps: value.

                -

                To verify and set attribute value +

                To verify and set attribute value {{TrustedType}} or string value for an attribute attribute, with element element:

                  -
                1. Let validValue be the result of calling +

                2. Let verifiedValue be the result of calling get Trusted Types-compliant attribute value for attribute, with element, value. [[!TRUSTED-TYPES]] -

                3. Set attribute's value to validValue. +

                4. Set attribute's value to verifiedValue.


                From f76755c8168518c4021d48f6220e9ff76e76e708 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Tue, 7 May 2024 16:41:29 +0100 Subject: [PATCH 16/23] Re-add early return --- dom.bs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dom.bs b/dom.bs index fca37a0d..a9bc4f8c 100644 --- a/dom.bs +++ b/dom.bs @@ -6602,6 +6602,8 @@ string namespace (default null):

                attr's namespace, attr's local name, and element. +
              3. If oldAttr is attr, return attr. +

              4. If oldAttr is non-null, then replace oldAttr with attr. From e5be35d0ee5cf2fbb875295430c9456220e22ec4 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Tue, 7 May 2024 16:49:03 +0100 Subject: [PATCH 17/23] Change dfn to use given rather than with --- dom.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom.bs b/dom.bs index a9bc4f8c..156fa5d1 100644 --- a/dom.bs +++ b/dom.bs @@ -6531,8 +6531,8 @@ optional boolean validate (default true):

              To verify and set attribute value -{{TrustedType}} or string value for an attribute attribute, with -element element: +{{TrustedType}} or string value for an attribute attribute, given an +Element element:

              1. Let verifiedValue be the result of calling From 982ef716d4278e50087b87800918ce4d3c449527 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 16 May 2024 16:38:19 +0100 Subject: [PATCH 18/23] Update how the enforcement is done --- dom.bs | 108 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 65 insertions(+), 43 deletions(-) diff --git a/dom.bs b/dom.bs index 156fa5d1..473c4a43 100644 --- a/dom.bs +++ b/dom.bs @@ -4540,8 +4540,7 @@ dom-Range-extractContents, dom-Range-cloneContents -->

                1. Let copyAttribute be a clone of attribute. -

                2. Append copyAttribute to copy, - with false. +

                3. Append copyAttribute to copy.

              @@ -6459,33 +6458,17 @@ given a document, localName, namespace, and opt
              1. Let oldValue be attribute's value.

              2. -
              3. Verify and set attribute value value for attribute, with - attribute's element. +

              4. Set attribute's value to value. -

              5. If attribute's element - has an attribute, then handle attribute changes for - attribute with attribute's element, oldValue, and - value. - -

              6. Otherwise, throw an "{{InvalidStateError!!exception}}" {{DOMException}}. +

              7. Handle attribute changes for attribute with attribute's + element, oldValue, and value.

              To append an -attribute attribute to an element element, with an -optional boolean validate (default true): +attribute attribute to an element element, run these +steps:

                -
              1. -

                If validate is true: - -

                  -
                1. Verify and set attribute value - attribute's value for attribute, with element. - -

                2. If element has an attribute - attribute, then throw an "{{InvalidStateError!!exception}}" {{DOMException}}. -

                -
              2. Append attribute to element's attribute list. @@ -6514,9 +6497,6 @@ optional boolean validate (default true): attribute oldAttr with an attribute newAttr, run these steps:

                  -
                1. Verify and set attribute value newAttr's value for - newAttr, with oldAttr's element. -

                2. Replace oldAttr by newAttr in oldAttr's element's attribute list. @@ -6530,16 +6510,14 @@ optional boolean validate (default true): value.

                -

                To verify and set attribute value +

                To verify attribute value {{TrustedType}} or string value for an attribute attribute, given an Element element:

                  -
                1. Let verifiedValue be the result of calling +

                2. Return the result of calling get Trusted Types-compliant attribute value for attribute, with element, value. [[!TRUSTED-TYPES]] - -

                3. Set attribute's value to verifiedValue.


                @@ -6604,6 +6582,11 @@ string namespace (default null):

              3. If oldAttr is attr, return attr. +

              4. Let verifiedValue be the result of calling verify attribute value + attr's value for attr, with element. + +

              5. Set attr's value to verifiedValue. +

              6. If oldAttr is non-null, then replace oldAttr with attr. @@ -6624,14 +6607,30 @@ or string namespace (default null): getting an attribute given namespace, localName, and element. -

              7. If attribute is null, create an attribute whose namespace is - namespace, namespace prefix is prefix, - local name is localName, value is value, and - node document is element's node document, then - append this attribute to element, and then - return. +
              8. Let attributeExists be false if attribute is null, and true otherwise. + +

              9. If attributeExists is false, set attribute to an attribute + whose namespace is namespace, namespace prefix is + prefix, local name is localName, value is + value, and node document is element's node + document. + +

              10. Let verifiedValue be the result of calling verify attribute value + value for attribute, with element. -

              11. Change attribute to value. +

              12. Set attributeExists to true if element has + an attribute attribute; otherwise false. + +

              13. If attributeExists is true, change + attribute to verifiedValue. + +

              14. Otherwise: +

                  +
                1. Set attribute's value to verifiedValue. + +

                2. Append this attribute to + element. +

            @@ -6892,12 +6891,29 @@ method steps are: and null otherwise. -
          4. If attribute is null, create an attribute whose - local name is qualifiedName, value is - value, and node document is this's node document, - then append this attribute to this, and then return. +

          5. Let attributeExists be false if attribute is null, and true otherwise. + +

          6. If attributeExists is false, set attribute to an attribute + whose local name is qualifiedName, value is + value, and node document is this's node + document. + +

          7. Let verifiedValue be the result of calling verify attribute value + value for attribute, with this. + +

          8. Set attributeExists to true if this has an + attribute attribute; otherwise false. -

          9. Change attribute to value. +

          10. If attributeExists is true, change + attribute to verifiedValue. + +

          11. Otherwise: +

              +
            1. Set attribute's value to verifiedValue. + +

            2. Append this attribute to + element. +

          The @@ -7467,7 +7483,13 @@ string value, run these steps:

        2. If attribute's element is null, then set attribute's value to value. -

        3. Otherwise, change attribute to value. +

        4. Otherwise: +

            +
          1. Let verifiedValue be the result of calling verify attribute value + value for attribute, with this. + +

          2. Change attribute to verifiedValue. +

        The {{Attr/value}} setter steps are to set an existing attribute value with this From f584e235fc2ce3c5f75d0b1e6ee8db6925459563 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 16 May 2024 17:38:21 +0100 Subject: [PATCH 19/23] Add tentative enforcement for toggleAttribute --- dom.bs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dom.bs b/dom.bs index 473c4a43..77905847 100644 --- a/dom.bs +++ b/dom.bs @@ -6971,11 +6971,17 @@ method steps are:

        If attribute is null, then:

          -
        1. If force is not given or is true, create an attribute whose +

        2. Set attribute to an attribute whose local name is qualifiedName, value is the empty - string, and node document is this's node document, then - append this attribute to this, and then return - true. + string, and node document is this's node document. + +

        3. Let verifiedValue be the result of calling verify attribute value + attribute's value for attribute, with this. + +

        4. Set attribute's value to verifiedValue. + +

        5. If force is not given or is true, then append + this attribute to this, and then return true.

        6. Return false.

        From 9b74d93ee062876a0c24a20dfac6e051baeeb4ae Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 16 May 2024 17:57:36 +0100 Subject: [PATCH 20/23] Update enforcement for toggleAttribute to match behaviour observed in Chrome. --- dom.bs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dom.bs b/dom.bs index 77905847..9f96474c 100644 --- a/dom.bs +++ b/dom.bs @@ -6971,6 +6971,8 @@ method steps are:

        If attribute is null, then:

          +
        1. If force is false, return false. +

        2. Set attribute to an attribute whose local name is qualifiedName, value is the empty string, and node document is this's node document. @@ -6978,12 +6980,20 @@ method steps are:

        3. Let verifiedValue be the result of calling verify attribute value attribute's value for attribute, with this. -

        4. Set attribute's value to verifiedValue. +

        5. Let existingAttribute be the first attribute in this's + attribute list whose qualified name is qualifiedName, + and null otherwise. + +

        6. If existingAttribute is null: +

            +
          1. Set attribute's value to verifiedValue. + +

          2. Append attribute to this. -

          3. If force is not given or is true, then append - this attribute to this, and then return true. +

          4. Return true. +

          -
        7. Return false. +

        8. Set existingAttribute's value to verifiedValue.

      6. Otherwise, if force is not given or is false, From d836a23197823481b7125b608aa2b3b7586dbb2e Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Tue, 11 Jun 2024 13:33:57 +0200 Subject: [PATCH 21/23] Revert "Update enforcement for toggleAttribute to match behaviour observed in Chrome." This reverts commit 2f00466aaa9ea9f01aa88dbe779cd1f02ffc437f. --- dom.bs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/dom.bs b/dom.bs index 9f96474c..77905847 100644 --- a/dom.bs +++ b/dom.bs @@ -6971,8 +6971,6 @@ method steps are:

        If attribute is null, then:

          -
        1. If force is false, return false. -

        2. Set attribute to an attribute whose local name is qualifiedName, value is the empty string, and node document is this's node document. @@ -6980,20 +6978,12 @@ method steps are:

        3. Let verifiedValue be the result of calling verify attribute value attribute's value for attribute, with this. -

        4. Let existingAttribute be the first attribute in this's - attribute list whose qualified name is qualifiedName, - and null otherwise. - -

        5. If existingAttribute is null: -

            -
          1. Set attribute's value to verifiedValue. - -

          2. Append attribute to this. +

          3. Set attribute's value to verifiedValue. -

          4. Return true. -

          +
        6. If force is not given or is true, then append + this attribute to this, and then return true. -

        7. Set existingAttribute's value to verifiedValue. +

        8. Return false.

      7. Otherwise, if force is not given or is false, From b0ecd77cf6d7c4e46ecb11f5e693df1894d92327 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Tue, 11 Jun 2024 13:35:44 +0200 Subject: [PATCH 22/23] Revert "Add tentative enforcement for toggleAttribute" This reverts commit 6e409647b112fe96d12583b8814d9f0a9980149e. --- dom.bs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/dom.bs b/dom.bs index 77905847..473c4a43 100644 --- a/dom.bs +++ b/dom.bs @@ -6971,17 +6971,11 @@ method steps are:

        If attribute is null, then:

          -
        1. Set attribute to an attribute whose +

        2. If force is not given or is true, create an attribute whose local name is qualifiedName, value is the empty - string, and node document is this's node document. - -

        3. Let verifiedValue be the result of calling verify attribute value - attribute's value for attribute, with this. - -

        4. Set attribute's value to verifiedValue. - -

        5. If force is not given or is true, then append - this attribute to this, and then return true. + string, and node document is this's node document, then + append this attribute to this, and then return + true.

        6. Return false.

        From d6b3b5af4ab92a5d9a10be1f31911d9175346e95 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 13 Jun 2024 17:21:58 +0200 Subject: [PATCH 23/23] Reintroduce infrastructure changes --- dom.bs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/dom.bs b/dom.bs index 473c4a43..0fc9bca7 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]] @@ -6599,8 +6601,9 @@ string namespace (default null):

        To set an attribute value given an element element, a string localName, a string or {{TrustedType}} -value, an optional null or string prefix (default null), and an optional null -or string namespace (default null): +value, an optional null or string prefix (default null), an optional null +or string namespace (default null), and an optional boolean verify +(default false):

        1. Let attribute be the result of @@ -6615,11 +6618,17 @@ or string namespace (default null): value, and node document is element's node document. -
        2. Let verifiedValue be the result of calling verify attribute value - value for attribute, with element. +

        3. Let verifiedValue be value. + +

        4. If verify is true: +

            +
          1. Set verifiedValue to the result of calling verify attribute value + value for attribute, with element. -

          2. Set attributeExists to true if element has - an attribute attribute; otherwise false. +

          3. Set attributeExists to true if element has + an attribute attribute; otherwise false. +

          +
        5. If attributeExists is true, change attribute to verifiedValue. @@ -6925,7 +6934,7 @@ method steps are: passing namespace and qualifiedName to validate and extract.

        6. Set an attribute value for this using localName, value, - and also prefix and namespace. + prefix, namespace and true.

        The