From a2ab430a2f49397363a364cebf5edb541eecdd8d Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 6 Dec 2019 14:37:27 +0100 Subject: [PATCH 1/4] Editorial: embrace that attributes are objects Closes #801. --- dom.bs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dom.bs b/dom.bs index f1d8d9406..28929e3ca 100644 --- a/dom.bs +++ b/dom.bs @@ -6124,6 +6124,8 @@ its attribute list is empty. attribute attribute to value, run these steps:
    +
  1. Assert: attribute's element is non-null. +

  2. Handle attribute changes for attribute with attribute's element, attribute's value, and value. @@ -6135,8 +6137,8 @@ its attribute list is empty. steps:

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

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

    3. Append attribute to element's attribute list. @@ -6148,8 +6150,12 @@ steps: attribute attribute, run these steps:

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

      2. Let element be attribute's element. + +

      3. Assert: element is non-null. + +

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

      5. Remove attribute from attribute's element's attribute list. @@ -6161,12 +6167,12 @@ steps: attribute oldAttr with an attribute newAttr, run these steps:
          -
        1. Handle attribute changes for oldAttr with oldAttr's - element, oldAttr's value, and newAttr's - value. +

        2. Let element be oldAttr's element. -

        3. Replace oldAttr by newAttr in oldAttr's - element's attribute list. +

        4. Assert: element is non-null. + +

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

        6. Set newAttr's element to oldAttr's element. From 1d0abe3967dd50cb64e3a0ddc3925ebba66400b0 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Sat, 7 Dec 2019 14:16:20 +0100 Subject: [PATCH 2/4] remove asserts and fix error --- dom.bs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/dom.bs b/dom.bs index 28929e3ca..f1d8d9406 100644 --- a/dom.bs +++ b/dom.bs @@ -6124,8 +6124,6 @@ its attribute list is empty. attribute attribute to value, run these steps:

            -
          1. Assert: attribute's element is non-null. -

          2. Handle attribute changes for attribute with attribute's element, attribute's value, and value. @@ -6137,8 +6135,8 @@ its attribute list is empty. steps:

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

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

            3. Append attribute to element's attribute list. @@ -6150,12 +6148,8 @@ steps: attribute attribute, run these steps:

                -
              1. Let element be attribute's element. - -

              2. Assert: element is non-null. - -

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

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

              5. Remove attribute from attribute's element's attribute list. @@ -6167,12 +6161,12 @@ steps: attribute oldAttr with an attribute newAttr, run these steps:
                  -
                1. Let element be oldAttr's element. - -

                2. Assert: element is non-null. +

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

                4. Handle attribute changes for oldAttr with element, - oldAttr's value, and newAttr's value. +

                5. Replace oldAttr by newAttr in oldAttr's + element's attribute list.

                6. Set newAttr's element to oldAttr's element. From 6caad6a40424985b8c1dc4cdce7fd4917ad62854 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Tue, 10 Dec 2019 18:16:40 +0100 Subject: [PATCH 3/4] Add support for attribute validate steps before attribute mutation. Allows for integrating with Trusted Types - see #789. Contains #805. --- dom.bs | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/dom.bs b/dom.bs index f1d8d9406..3f77a5a09 100644 --- a/dom.bs +++ b/dom.bs @@ -4228,7 +4228,9 @@ 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 copyAttribute's value.

                @@ -6101,10 +6103,20 @@ its attribute list is empty. elements. The algorithm is passed element, localName, oldValue, value, and namespace. +

                This and other specifications may define +attribute validation steps for +elements. The algorithm is passed element, localName, +value, and namespace. +

                To handle attribute changes for an attribute attribute with element, oldValue, and newValue, run these steps:

                  +
                1. Run the attribute validation steps with element, + attribute's local name, newValue and + attribute's namespace. If this throws an exception, then + rethrow the exception and abort further steps. +

                2. Queue a mutation record of "attributes" for element with attribute's local name, attribute's namespace, oldValue, « », « », null, and null. @@ -6131,12 +6143,14 @@ its attribute list is empty.

                To append an -attribute attribute to an element element, run these -steps: +attribute attribute to an element element +with a value, run these steps:

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

                2. Set attribute's value to value.

                3. Append attribute to element's attribute list. @@ -6235,7 +6249,8 @@ run these steps:

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

                5. Otherwise, append attr to element. +

                6. Otherwise, append attr to element + with attr's value.

                7. Return oldAttr.

                @@ -6255,10 +6270,9 @@ optional prefix, and namespace, run these steps:
              6. 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. + local name is localName and node document is + element's node document, then append + this attribute to element with value, and then return.
              7. Change attribute to value.

              @@ -6521,10 +6535,9 @@ method, when invoked, must run these steps:
            4. If attribute is null, create an attribute whose - local name is qualifiedName, value is - value, and node document is context object's - node document, then append this attribute to - context object, and then return. + local name is qualifiedName and node document + is context object's node document, then append + this attribute to context object with value and then return.

            5. Change attribute to value.

            @@ -6586,10 +6599,9 @@ method, when invoked, must run these steps:
            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 the context object's - node document, then append this attribute - to the context object, and then return true. + local name is qualifiedName and node document + is the context object's node document, then append + this attribute to the context object with an empty string, and then return true.

            2. Return false.

            From cc379857acc3a5b05eff9f64ca5ec9f989913332 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Thu, 12 Dec 2019 09:46:30 -0500 Subject: [PATCH 4/4] Added myself to Acknowledgements section. --- dom.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/dom.bs b/dom.bs index 3f77a5a09..d53be3d9d 100644 --- a/dom.bs +++ b/dom.bs @@ -10106,6 +10106,7 @@ Justin Summerlin, Kevin Sweeney, Kirill Topolyan, Koji Ishii, +Krzysztof Kotowicz, Lachlan Hunt, Lauren Wood, Luke Zielinski,