From 4880751c996aa0b11955236d0f6b2e68977d2619 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Sat, 25 Mar 2023 09:29:17 -0700 Subject: [PATCH 1/4] Handle attribute changes after changing attribute At least in chromium, synchronous internal listeners for attribute changes which are run as "attribute change steps" are run after the attribute is actually changed, not before. This affects popover attribute related algorithms in HTML: https://github.com/whatwg/html/pull/9048#discussion_r1141122175 --- dom.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom.bs b/dom.bs index 6eefb8169..a94923880 100644 --- a/dom.bs +++ b/dom.bs @@ -6185,10 +6185,10 @@ given a document, localName, namespace, and opt attribute attribute to value, run these steps:
    +
  1. Set attribute's value to value. +

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

  3. Set attribute's value to value.

To append an From f9cb9a0ceb3112404268a7f399b8e3716d898ce9 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Tue, 11 Apr 2023 13:45:33 -0700 Subject: [PATCH 2/4] Move handle attribute changes for all mutations --- dom.bs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dom.bs b/dom.bs index a94923880..8dddc5ec0 100644 --- a/dom.bs +++ b/dom.bs @@ -6196,36 +6196,32 @@ given a document, localName, namespace, and opt steps:

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

  2. Append attribute to element's attribute list.

  3. Set attribute's element to element. + +

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

To remove an attribute attribute, run these steps:

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

  2. Remove attribute from attribute's element's attribute list.
  3. Set attribute's element to null. + +

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

To replace an 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. Replace oldAttr by newAttr in oldAttr's element's attribute list. @@ -6233,6 +6229,10 @@ steps: element.

  3. Set oldAttr's element to null. + +

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


From 02de196c6f05bdf2d86521f0b98951a6fb664189 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 1 May 2023 11:47:18 -0700 Subject: [PATCH 3/4] store element in a variable during removal --- dom.bs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dom.bs b/dom.bs index 8dddc5ec0..5c2a33cce 100644 --- a/dom.bs +++ b/dom.bs @@ -6209,13 +6209,15 @@ steps: attribute attribute, run these steps:
    -
  1. Remove attribute from attribute's - element's attribute list. +
  2. Let element be attribute's element.

  3. + +
  4. Remove attribute from element's attribute + list.
  5. Set attribute's element to null. -

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

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

To replace an From 40d679df5d7746c5a61d3e638086b08174184602 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 1 May 2023 11:56:32 -0700 Subject: [PATCH 4/4] use newattr's element --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 5c2a33cce..2dfbaa6a6 100644 --- a/dom.bs +++ b/dom.bs @@ -6232,7 +6232,7 @@ steps:

  • Set oldAttr's element to null. -

  • Handle attribute changes for oldAttr with oldAttr's +

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