From d88b1216cc82934d849900478fe02be8eb490ea8 Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Wed, 15 Feb 2023 19:34:02 -0800 Subject: [PATCH 1/9] Use ToggleEvent for
element toggle event --- source | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source b/source index 696823da581..64c53fa9e58 100644 --- a/source +++ b/source @@ -59805,8 +59805,19 @@ interface HTMLDetailsElement : HTMLElement { fired.

-
  • Fire an event named toggle at the details element.

  • +
  • If the open attribute is added, fire an event named toggle + using ToggleEvent, with the oldState + attribute initialized to "closed", and the newState attribute initialized to "open" at the details element.

  • + +
  • Otherwise, fire an event named toggle using ToggleEvent, with the oldState attribute initialized to "open", and the newState + attribute initialized to "closed" at the details + element.

  • The open @@ -137980,7 +137991,7 @@ INSERT INTERFACES HERE toggle - Event or ToggleEvent + ToggleEvent details and popover elements Fired at details elements when they open or close; fired on elements with the popover attribute when they are transitioning between From 752b8d1e557dfffe785b9c768d9c4d9eb1810f3b Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Sun, 20 Aug 2023 14:05:24 +0900 Subject: [PATCH 2/9] Use task coalescing --- source | 81 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 22 deletions(-) diff --git a/source b/source index 64c53fa9e58..83c154ec62e 100644 --- a/source +++ b/source @@ -59788,36 +59788,73 @@ interface HTMLDetailsElement : HTMLElement { exists, user agents can still provide this ability through some other user interface affordance.

    +

    Every details element has a details toggle task, initially null, which + is either null or a struct which has:

    + +
    +
    Task
    A task which fires a + ToggleEvent.
    + +
    Old state
    +
    A string which represents the task's event's + value for the oldState attribute.
    +
    +

    Whenever the open attribute is added to or removed from - a details element, the user agent must queue an element task on the - DOM manipulation task source given then details element that runs the - following steps, which are known as the details notification task steps, for this - details element:

    + a details element, the user agent must run the following steps, which are known as + the details notification task steps, for this details element:

    + +

    When the open attribute is toggled several + times in succession, the resulting tasks essentially get coalesced so that only one event is + fired.

    + +
      +
    1. If the open attribute is added, queue a + details toggle event task given the details element, "closed", and "open".

    2. + +
    3. Otherwise, queue a details toggle event task given the details + element, "open", and "closed".

    4. + +
    + +

    To queue a details toggle event task given a details element + element, a string oldState, and a string newState:

    1. -

      If another task has been queued to run the details notification task steps for this - details element, then return.

      +

      If element's details toggle task is not null, then:

      -

      When the open attribute is toggled - several times in succession, these steps essentially get coalesced so that only one event is - fired.

      +
        +
      1. Set oldState to element's details toggle task's + old state.

      2. + +
      3. Remove element's details toggle task's task from its task queue.

      4. + +
      5. Set element's details toggle task to null.

      6. +
    2. -
    3. If the open attribute is added, fire an event named toggle - using ToggleEvent, with the oldState - attribute initialized to "closed", and the newState attribute initialized to "open" at the details element.

    4. +
    5. +

      Queue an element task given the DOM manipulation task source and + element to run the following steps:

      -
    6. Otherwise, fire an event named toggle using ToggleEvent, with the oldState attribute initialized to "open", and the newState - attribute initialized to "closed" at the details - element.

    7. +
        +
      1. fire an event named toggle, using ToggleEvent, with the oldState attribute initialized to oldState, + and the newState attribute initialized to + newState at element.

      2. + +
      3. Set element's details toggle task to null.

      4. +
      + + +
    8. Set element's details toggle task to a struct with task set to the just-queued task and old + state set to oldState.

    The open From 4e90fc4ed312ab47953a66ed000482016a8e0c1d Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Wed, 23 Aug 2023 20:49:51 +0900 Subject: [PATCH 3/9] Address some review comments (and also apply in popover section) --- source | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/source b/source index 83c154ec62e..82ac4c2bff9 100644 --- a/source +++ b/source @@ -59792,10 +59792,10 @@ interface HTMLDetailsElement : HTMLElement { is either null or a struct which has:

    -
    Task
    A task which fires a - ToggleEvent.
    +
    task
    A task which fires a ToggleEvent.
    -
    Old state
    +
    old state
    A string which represents the task's event's value for the oldState attribute.
    @@ -59841,11 +59841,11 @@ interface HTMLDetailsElement : HTMLElement { element to run the following steps:

      -
    1. fire an event named toggle, using ToggleEvent, with the oldState attribute initialized to oldState, - and the newState attribute initialized to - newState at element.

    2. +
    3. Fire an event named toggle at element, using ToggleEvent, with + the oldState attribute initialized to + oldState, and the newState attribute + initialized to newState.

    4. Set element's details toggle task to null.

    @@ -82652,10 +82652,10 @@ dictionary DragEventInit : MouseEventInit { initially null, which is either null or a struct which has:

    -
    Task
    A task which fires a - ToggleEvent.
    +
    task
    A task which fires a ToggleEvent.
    -
    Old state
    +
    old state
    A string which represents the task's event's value for the oldState attribute.
    @@ -82842,11 +82842,11 @@ dictionary DragEventInit : MouseEventInit { element to run the following steps:

      -
    1. fire an event named toggle, using ToggleEvent, with the oldState attribute initialized to oldState, - and the newState attribute initialized to - newState at element.

    2. +
    3. Fire an event named toggle at element, using ToggleEvent, with + the oldState attribute initialized to + oldState, and the newState attribute + initialized to newState.

    4. Set element's popover toggle task to null.

    From cb117c366d4868e4a235656907ab61791453b904 Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Thu, 24 Aug 2023 04:09:07 +0900 Subject: [PATCH 4/9] Remove comma per review comments --- source | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source b/source index 82ac4c2bff9..bc6d0ef4220 100644 --- a/source +++ b/source @@ -59844,7 +59844,7 @@ interface HTMLDetailsElement : HTMLElement {
  • Fire an event named toggle at element, using ToggleEvent, with the oldState attribute initialized to - oldState, and the newState attribute + oldState and the newState attribute initialized to newState.

  • Set element's details toggle task to null.

  • @@ -82845,7 +82845,7 @@ dictionary DragEventInit : MouseEventInit {
  • Fire an event named toggle at element, using ToggleEvent, with the oldState attribute initialized to - oldState, and the newState attribute + oldState and the newState attribute initialized to newState.

  • Set element's popover toggle task to null.

  • @@ -82921,7 +82921,7 @@ dictionary DragEventInit : MouseEventInit {
  • Fire an event named beforetoggle, using ToggleEvent, with the oldState attribute initialized to "open", and the newState + data-x="">open" and the newState attribute initialized to "closed" at element.

  • From efc6d3307f25bc3753335efc7dfa617fc20d2a0c Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Thu, 24 Aug 2023 04:14:17 +0900 Subject: [PATCH 5/9] =?UTF-8?q?Move=20ToggleEvent=20to=20=E2=80=9CActivati?= =?UTF-8?q?on=20behavior=20of=20elements=E2=80=9D=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/source b/source index bc6d0ef4220..ea61bd4bc9a 100644 --- a/source +++ b/source @@ -77661,6 +77661,61 @@ partial interface Navigator { +

    The ToggleEvent interface

    + +
    [Exposed=Window]
    +interface ToggleEvent : Event {
    +  constructor(DOMString type, optional ToggleEventInit eventInitDict = {});
    +  readonly attribute DOMString oldState;
    +  readonly attribute DOMString newState;
    +};
    +
    +dictionary ToggleEventInit : EventInit {
    +  DOMString oldState = "";
    +  DOMString newState = "";
    +};
    + +
    +
    event.oldState
    + +
    +

    Set to "closed" when transitioning from closed to open, or set to + "open" when transitioning from open to closed.

    +
    + +
    event.newState
    + +
    +

    Set to "open" when transitioning from closed to open, or set to "closed" when transitioning from open to closed.

    +
    +
    + +

    The oldState attribute must return the value it + was initialized to. It is initialized to "open" if the element with the + popover attribute's popover visibility state is + showing; otherwise "closed".

    + +

    The newState attribute must return the value it was + initialized to. It is initialized to "closed" if the element with the popover attribute's popover visibility state is showing; otherwise "open".

    + +

    A toggle task tracker is either null or a struct which has:

    + +
    +
    task
    +
    A task which fires a ToggleEvent.
    + +
    old state
    +
    A string which represents the task's event's value for + the oldState attribute.
    +

    Focus

    From f3ed33212daf311178b142878641ff7310fc1609 Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Thu, 24 Aug 2023 04:18:26 +0900 Subject: [PATCH 6/9] Remove popover-specific (non-normative) text from ToggleEvent definition --- source | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/source b/source index ea61bd4bc9a..bbdb0505039 100644 --- a/source +++ b/source @@ -77694,17 +77694,9 @@ dictionary ToggleEventInit : EventInit {

    The oldState attribute must return the value it - was initialized to. It is initialized to "open" if the element with the - popover attribute's popover visibility state is - showing; otherwise "closed".

    - -

    The newState attribute must return the value it was - initialized to. It is initialized to "closed" if the element with the popover attribute's popover visibility state is showing; otherwise "open".

    + data-x="dom-ToggleEvent-oldState">oldState and newState attributes must return the values they are + initialized to.

    A toggle task tracker is either null or a struct which has:

    From 55c6d83c2a80acf912ea681a3595b393b0fb277f Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Thu, 24 Aug 2023 04:02:07 +0900 Subject: [PATCH 7/9] =?UTF-8?q?Consolidate=20into=20a=20shared=20=E2=80=9C?= =?UTF-8?q?toggle=20task=20tracker=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source | 79 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/source b/source index bbdb0505039..2f769fde836 100644 --- a/source +++ b/source @@ -59788,17 +59788,7 @@ interface HTMLDetailsElement : HTMLElement { exists, user agents can still provide this ability through some other user interface affordance.

    -

    Every details element has a details toggle task, initially null, which - is either null or a struct which has:

    - -
    -
    task
    A task which fires a ToggleEvent.
    - -
    old state
    -
    A string which represents the task's event's - value for the oldState attribute.
    -
    +

    Every details element has a toggle task tracker, initially null.

    Whenever the open attribute is added to or removed from a details element, the user agent must run the following steps, which are known as @@ -59823,16 +59813,16 @@ interface HTMLDetailsElement : HTMLElement {

    1. -

      If element's details toggle task is not null, then:

      +

      If element's toggle task tracker is not null, then:

        -
      1. Set oldState to element's details toggle task's - old state.

      2. +
      3. Set oldState to element's toggle task tracker's + old state.

      4. -
      5. Remove element's details toggle task's task from its task queue.

      6. +
      7. Remove element's toggle task tracker's task from its task queue.

      8. -
      9. Set element's details toggle task to null.

      10. +
      11. Set element's toggle task tracker to null.

    2. @@ -59847,14 +59837,14 @@ interface HTMLDetailsElement : HTMLElement { oldState and the newState attribute initialized to newState.

      -
    3. Set element's details toggle task to null.

    4. +
    5. Set element's toggle task tracker to null.

  • -
  • Set element's details toggle task to a struct with task set to the just-queued task and old - state set to oldState.

  • +
  • Set element's toggle task tracker to a struct with task set to the just-queued task and old state set + to oldState.

  • The open @@ -82695,17 +82685,8 @@ dictionary DragEventInit : MouseEventInit {

    Every HTML element has a popover showing or hiding, which is a boolean, initially set to false.

    -

    Every HTML element has a popover toggle task, - initially null, which is either null or a struct which has:

    - -
    -
    task
    A task which fires a ToggleEvent.
    - -
    old state
    -
    A string which represents the task's event's - value for the oldState attribute.
    -
    +

    Every HTML element has a toggle task tracker, + initially null.

    The following attribute change steps, given element, localName, oldValue, @@ -82871,16 +82852,16 @@ dictionary DragEventInit : MouseEventInit {

    1. -

      If element's popover toggle task is not null, then:

      +

      If element's toggle task tracker is not null, then:

        -
      1. Set oldState to element's popover toggle task's - old state.

      2. +
      3. Set oldState to element's toggle task tracker's + old state.

      4. -
      5. Remove element's popover toggle task's task from its task queue.

      6. +
      7. Remove element's toggle task tracker's task from its task queue.

      8. -
      9. Set element's popover toggle task to null.

      10. +
      11. Set element's toggle task tracker to null.

    2. @@ -82895,14 +82876,14 @@ dictionary DragEventInit : MouseEventInit { oldState and the newState attribute initialized to newState.

      -
    3. Set element's popover toggle task to null.

    4. +
    5. Set element's toggle task tracker to null.

    -
  • Set element's popover toggle task to a struct with task set to the just-queued task and old - state set to oldState.

  • +
  • Set element's toggle task tracker to a struct with task set to the just-queued task and old state set + to oldState.

  • The hidePopover() @@ -83672,6 +83653,16 @@ dictionary ToggleEventInit : EventInit { data-x="attr-popover">popover attribute's popover visibility state is showing; otherwise "open".

    +

    A toggle task tracker is either null or a struct which has:

    + +
    +
    task
    +
    A task which fires a ToggleEvent.
    + +
    old state
    +
    A string which represents the task's event's value for + the oldState attribute.
    +

    Loading web pages

    From 47ac7d1a67faa31ddd18a0081c30468305dbe252 Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Thu, 24 Aug 2023 14:46:46 +0900 Subject: [PATCH 8/9] =?UTF-8?q?Make=20it=20=E2=80=9Cdetails=20toggle=20tas?= =?UTF-8?q?k=20tracker=E2=80=9D=20&=20=E2=80=9Cpopover=20toggle=20task=20t?= =?UTF-8?q?racker=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source | 92 ++++++++++++---------------------------------------------- 1 file changed, 19 insertions(+), 73 deletions(-) diff --git a/source b/source index 2f769fde836..9219628971b 100644 --- a/source +++ b/source @@ -59788,7 +59788,8 @@ interface HTMLDetailsElement : HTMLElement { exists, user agents can still provide this ability through some other user interface affordance.

    -

    Every details element has a toggle task tracker, initially null.

    +

    Every details element has a details toggle task tracker, which is a + toggle task tracker or null, initially null

    Whenever the open attribute is added to or removed from a details element, the user agent must run the following steps, which are known as @@ -59813,16 +59814,16 @@ interface HTMLDetailsElement : HTMLElement {

    1. -

      If element's toggle task tracker is not null, then:

      +

      If element's details toggle task tracker is not null, then:

        -
      1. Set oldState to element's toggle task tracker's - old state.

      2. +
      3. Set oldState to element's details toggle task + tracker's old state.

      4. -
      5. Remove element's toggle task tracker's

        Remove element's details toggle task tracker's task from its task queue.

      6. -
      7. Set element's toggle task tracker to null.

      8. +
      9. Set element's details toggle task tracker to null.

    2. @@ -59837,11 +59838,11 @@ interface HTMLDetailsElement : HTMLElement { oldState and the newState attribute initialized to newState.

      -
    3. Set element's toggle task tracker to null.

    4. +
    5. Set element's details toggle task tracker to null.

    -
  • Set element's toggle task tracker to a struct with

    Set element's details toggle task tracker to a struct with task set to the just-queued task and old state set to oldState.

  • @@ -77688,7 +77689,7 @@ dictionary ToggleEventInit : EventInit { data-x="dom-ToggleEvent-newState">newState attributes must return the values they are initialized to.

    -

    A toggle task tracker is either null or a struct which has:

    +

    A toggle task tracker is a struct which has:

    task
    @@ -82685,8 +82686,8 @@ dictionary DragEventInit : MouseEventInit {

    Every HTML element has a popover showing or hiding, which is a boolean, initially set to false.

    -

    Every HTML element has a toggle task tracker, - initially null.

    +

    Every HTML element popover toggle task tracker, + which is a toggle task tracker or null, initially nul.

    The following attribute change steps, given element, localName, oldValue, @@ -82852,16 +82853,16 @@ dictionary DragEventInit : MouseEventInit {

    1. -

      If element's toggle task tracker is not null, then:

      +

      If element's popover toggle task tracker is not null, then:

        -
      1. Set oldState to element's toggle task tracker's - old state.

      2. +
      3. Set oldState to element's popover toggle task + tracker's old state.

      4. -
      5. Remove element's toggle task tracker's

        Remove element's popover toggle task tracker's task from its task queue.

      6. -
      7. Set element's toggle task tracker to null.

      8. +
      9. Set element's popover toggle task tracker to null.

    2. @@ -82876,11 +82877,11 @@ dictionary DragEventInit : MouseEventInit { oldState and the newState attribute initialized to newState.

      -
    3. Set element's toggle task tracker to null.

    4. +
    5. Set element's popover toggle task tracker to null.

    -
  • Set element's toggle task tracker to a struct with

    Set element's popover toggle task tracker to a struct with task set to the just-queued task and old state set to oldState.

  • @@ -83608,61 +83609,6 @@ dictionary DragEventInit : MouseEventInit { -

    The ToggleEvent interface

    - -
    [Exposed=Window]
    -interface ToggleEvent : Event {
    -  constructor(DOMString type, optional ToggleEventInit eventInitDict = {});
    -  readonly attribute DOMString oldState;
    -  readonly attribute DOMString newState;
    -};
    -
    -dictionary ToggleEventInit : EventInit {
    -  DOMString oldState = "";
    -  DOMString newState = "";
    -};
    - -
    -
    event.oldState
    - -
    -

    Set to "closed" when transitioning from closed to open, or set to - "open" when transitioning from open to closed.

    -
    - -
    event.newState
    - -
    -

    Set to "open" when transitioning from closed to open, or set to "closed" when transitioning from open to closed.

    -
    -
    - -

    The oldState attribute must return the value it - was initialized to. It is initialized to "open" if the element with the - popover attribute's popover visibility state is - showing; otherwise "closed".

    - -

    The newState attribute must return the value it was - initialized to. It is initialized to "closed" if the element with the popover attribute's popover visibility state is showing; otherwise "open".

    - -

    A toggle task tracker is either null or a struct which has:

    - -
    -
    task
    -
    A task which fires a ToggleEvent.
    - -
    old state
    -
    A string which represents the task's event's value for - the oldState attribute.
    -

    Loading web pages

    From 961f13e3691341634f4710d99f3bff90165619ad Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 25 Aug 2023 12:03:11 -0700 Subject: [PATCH 9/9] Nit fixes --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 9219628971b..07b2df2d4e4 100644 --- a/source +++ b/source @@ -59789,7 +59789,7 @@ interface HTMLDetailsElement : HTMLElement { affordance.

    Every details element has a details toggle task tracker, which is a - toggle task tracker or null, initially null

    + toggle task tracker or null, initially null.

    Whenever the open attribute is added to or removed from a details element, the user agent must run the following steps, which are known as @@ -82687,7 +82687,7 @@ dictionary DragEventInit : MouseEventInit { hiding, which is a boolean, initially set to false.

    Every HTML element popover toggle task tracker, - which is a toggle task tracker or null, initially nul.

    + which is a toggle task tracker or null, initially null.

    The following attribute change steps, given element, localName, oldValue,