From c85fb47b1b14490521bec65a4b718b7f25a1b98e Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 27 Jan 2025 20:28:20 +0000 Subject: [PATCH 1/4] Add attribute changed steps to dialog element When the dialogs open attribute is removed: 1. Remove dialog from the document's open dialogs list. 2. Destroy and nullify dialog's close watcher This also adds an assertion to the start of 'set the dialog close watcher' that dialog's close watcher is null. --- source | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/source b/source index 213f90acbef..4861fae586c 100644 --- a/source +++ b/source @@ -62084,6 +62084,38 @@ interface HTMLDialogElement : HTMLElement { removedNode's node document's open dialogs list.

+

The following attribute change + steps, given element, localName, oldValue, + value, and namespace are used for dialog elements:

+ +
    +
  1. If namespace is not null, then return.

  2. + +
  3. If localName is not open, then + return.

  4. + +
  5. If value is null:

    + +
      +
    1. Remove element from element's + node document's open dialogs list.

    2. + +
    3. +

      If element's close watcher is not + null, then:

      + +
        +
      1. Destroy element's close watcher.

      2. + +
      3. Set element's close watcher to + null.

      4. +
      +
    4. +
    +
  6. +
+

To show a modal dialog given a dialog element subject:

    @@ -62178,6 +62210,9 @@ interface HTMLDialogElement : HTMLElement { element dialog:

      +
    1. Assert: dialog's close + watcher is null.

    2. +
    3. Set dialog's close watcher to the result of establishing a close watcher given From 376c837f99ab031b60096312fc930e346e335b61 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Sun, 2 Feb 2025 22:33:27 +0000 Subject: [PATCH 2/4] Replace assert in set the dialog close watcher with an early return --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 4861fae586c..5079500bc10 100644 --- a/source +++ b/source @@ -62210,8 +62210,8 @@ interface HTMLDialogElement : HTMLElement { element dialog:

        -
      1. Assert: dialog's close - watcher is null.

      2. +
      3. If dialog's close watcher is not + null, then return.

      4. Set dialog's close watcher to the From b84aabe32f4dbf83c4ad998c46e5182e98642ec0 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Wed, 12 Feb 2025 12:09:58 +0000 Subject: [PATCH 3/4] Add dialog attribute change steps when adding open attribute Address review comments --- source | 54 +++++++++++++++++++----------------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/source b/source index 5079500bc10..331d3dbd064 100644 --- a/source +++ b/source @@ -61905,15 +61905,6 @@ interface HTMLDialogElement : HTMLElement {

      5. Add an open attribute to this, whose value is the empty string.

      6. -
      7. Assert: this's node document's open - dialogs list does not contain - this.

      8. - -
      9. Add this to this's node document's open - dialogs list.

      10. - -
      11. Set the dialog close watcher with this.

      12. -
      13. Set this's previously focused element to the focused element.

      14. @@ -62094,9 +62085,13 @@ interface HTMLDialogElement : HTMLElement {
      15. If localName is not open, then return.

      16. -
      17. If value is null:

        +
      18. If value is null and oldValue is not null:

          +
        1. Assert: element's node document's open + dialogs list contains + element.

        2. +
        3. Remove element from element's node document's open dialogs list.

        4. @@ -62114,6 +62109,20 @@ interface HTMLDialogElement : HTMLElement {
      19. + +
      20. If value is not null and oldValue is null:

        + +
          +
        1. Assert: element's node document's open + dialogs list does not contain + element.

        2. + +
        3. Add element to this's node document's open + dialogs list.

        4. + +
        5. Set the dialog close watcher with element.

        6. +
        +

      To show a modal dialog given a dialog element subject:

      @@ -62159,13 +62168,6 @@ interface HTMLDialogElement : HTMLElement {
    4. Set is modal of subject to true.

    5. -
    6. Assert: subject's node document's open - dialogs list does not contain - subject.

    7. - -
    8. Add subject to subject's node document's open - dialogs list.

    9. -
    10. Let subject's node document be blocked by the modal dialog subject.

      @@ -62182,8 +62184,6 @@ interface HTMLDialogElement : HTMLElement { already contain subject, then add an element to the top layer given subject.

    11. -
    12. Set the dialog close watcher with subject.

    13. -
    14. Set subject's previously focused element to the focused element.

    15. @@ -62269,9 +62269,6 @@ interface HTMLDialogElement : HTMLElement {
    16. Set is modal of subject to false.

    17. -
    18. Remove subject from subject's - node document's open dialogs list.

    19. -
    20. If result is not null, then set the returnValue attribute to result.

    21. @@ -62297,19 +62294,6 @@ interface HTMLDialogElement : HTMLElement {
    22. Queue an element task on the user interaction task source given the subject element to fire an event named close at subject.

    23. - -
    24. -

      If subject's close watcher is not null, - then:

      - -
        -
      1. Destroy subject's close watcher.

      2. - -
      3. Set subject's close watcher to - null.

      4. -
      -
    From 931fd03f0e9af58703bb40aa12e0d9a03e965cb6 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Wed, 12 Feb 2025 12:34:27 +0000 Subject: [PATCH 4/4] Run specfmt --- source | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source b/source index 331d3dbd064..484e0b247d6 100644 --- a/source +++ b/source @@ -62089,8 +62089,7 @@ interface HTMLDialogElement : HTMLElement {
    1. Assert: element's node document's open - dialogs list contains - element.

    2. + dialogs list contains element.

    3. Remove element from element's node document's open dialogs list.