From 9b41097951f8afb7357335bdaf25f6cad998137c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 29 May 2025 14:23:40 -0700 Subject: [PATCH 1/4] Improve CommandEvent.source retargeting This change prevents CommandEvent.source from leaking nodes across shadow boundaries. More context here: https://github.com/whatwg/html/pull/11255#issuecomment-2904297386 --- source | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/source b/source index 76281111e3d..e6d4b3b9780 100644 --- a/source +++ b/source @@ -80565,10 +80565,21 @@ dictionary CommandEventInit : EventInit { initialized to.

The source getter steps are to - return the result of retargeting source against this's currentTarget.

+ for="CommandEvent">source getter steps + are:

+ +
    +
  1. Let retargetAgainst be this's currentTarget.

  2. + +
  3. If retargetAgainst is null, then set retargetAgainst to + this's target.

  4. + +
  5. If retargetAgainst is null, then return null.

  6. + +
  7. Return the result of retargeting source against retargetAgainst.

  8. +

DOM standard issue #1328 tracks how to better standardize associated event data in a way which makes sense on Events. From 68da488f80fc6ec54134daeef17e9e0ff052d2cb Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 2 Jun 2025 12:56:50 -0700 Subject: [PATCH 2/4] retarget toggleevent.source --- source | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/source b/source index 82cbf24d5cd..aaf38141b5b 100644 --- a/source +++ b/source @@ -80604,11 +80604,10 @@ dictionary ToggleEventInit : EventInit { data-x="dom-ToggleEvent-newState">newState attributes must return the values they are initialized to.

-

The source getter steps are to return the result of - retargeting source against this's currentTarget.

+

The source + getter steps are to return the result of retarget against an event given + this and this's source.

DOM standard issue #1328 tracks how to better standardize associated event data in a way which makes sense on Events. @@ -80661,27 +80660,31 @@ dictionary CommandEventInit : EventInit { initialized to.

The source getter steps - are:

+ for="CommandEvent">source getter steps are to + return the result of retarget against an event given this and + this's source.

+ +

DOM standard issue #1328 + tracks how to better standardize associated event data in a way which makes sense on Events. + Currently an event attribute initialized to a value cannot also have a getter, and so an internal + slot (or map of additional fields) is required to properly specify this.

+ +

To retarget against an event, given an Event event and a + Node node:

    -
  1. Let retargetAgainst be this's

    Let retargetAgainst be event's currentTarget.

  2. If retargetAgainst is null, then set retargetAgainst to - this's target.

  3. + event's target.

  4. If retargetAgainst is null, then return null.

  5. -
  6. Return the result of retargeting source against retargetAgainst.

  7. +
  8. Return the result of retargeting node + against retargetAgainst.

-

DOM standard issue #1328 - tracks how to better standardize associated event data in a way which makes sense on Events. - Currently an event attribute initialized to a value cannot also have a getter, and so an internal - slot (or map of additional fields) is required to properly specify this.

-

Focus

From f5d97a23a7d761e5d6b20c6a0e56dca3b4eaa9c4 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Tue, 17 Jun 2025 09:04:01 -0700 Subject: [PATCH 3/4] stop using currentTarget --- source | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source b/source index aaf38141b5b..d850191d011 100644 --- a/source +++ b/source @@ -80673,13 +80673,8 @@ dictionary CommandEventInit : EventInit { Node node:

    -
  1. Let retargetAgainst be event's currentTarget.

  2. - -
  3. If retargetAgainst is null, then set retargetAgainst to - event's target.

  4. - -
  5. If retargetAgainst is null, then return null.

  6. +
  7. If event's target is null, then + return null.

  8. Return the result of retargeting node against retargetAgainst.

  9. From 6bd255f0f5d3826a9783d10bd97ae17e8c70bade Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 7 Jul 2025 17:27:30 -0700 Subject: [PATCH 4/4] fix retargetAgainst --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index a3dfda635f4..288b6942eeb 100644 --- a/source +++ b/source @@ -80666,7 +80666,7 @@ dictionary CommandEventInit : EventInit { return null.

  10. Return the result of retargeting node - against retargetAgainst.

  11. + against event's target.

Focus