From 184fbb30011fa617e52e028219d345d11d8acbce 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 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.