diff --git a/dom.bs b/dom.bs index 9321d93d4..e88bbf5d5 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]] @@ -6033,8 +6035,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); @@ -6357,7 +6359,8 @@ given a document, localName, namespace, and opt

  1. Let oldValue be attribute's value.

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

  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. @@ -6409,6 +6412,18 @@ steps: value.

+

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

    +
  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. +

+
@@ -6471,6 +6486,9 @@ string namespace (default null):

  • If oldAttr is attr, return attr. +

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

  • If oldAttr is non-null, then replace oldAttr with attr. @@ -6482,21 +6500,30 @@ string namespace (default null):

    To set an attribute value given an -element element, a string localName, a string 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 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. +
    3. +

      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. Append attribute to element. + +

      4. Return. +

    4. Change attribute to value.

    @@ -6759,10 +6786,21 @@ method steps are: and null otherwise. -
  • 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. +

  • +

    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. +

  • Change attribute to value.