From 55af76e860c7eaf196d1c8d562d42c0b351812ff Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 16 May 2024 16:38:19 +0100 Subject: [PATCH] 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 abfefa6e..6b0b76a0 100644 --- a/dom.bs +++ b/dom.bs @@ -4487,8 +4487,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.

@@ -6406,33 +6405,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. @@ -6461,9 +6444,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. @@ -6477,16 +6457,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.


    @@ -6551,6 +6529,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. @@ -6571,14 +6554,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. +

@@ -6839,12 +6838,29 @@ 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. +

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

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

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

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

  • Change attribute to value. +

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

  • Otherwise: +

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

    2. Append this attribute to + element. +

    The @@ -7414,7 +7430,13 @@ string value, run these steps:

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

  • Otherwise, change attribute to value. +

  • 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