From 6d4b27d7bc8a4d1df12a7eec1846d1749a7dac6f Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Tue, 23 Jan 2024 17:06:06 +0100 Subject: [PATCH] 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 e36c26e1..3f2adf3a 100644 --- a/dom.bs +++ b/dom.bs @@ -6080,8 +6080,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); @@ -6403,6 +6403,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. @@ -6416,6 +6420,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. @@ -6444,6 +6453,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. @@ -6530,7 +6544,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): @@ -6541,7 +6555,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. @@ -6809,7 +6823,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.