From 20ee86093850ecd6fb2f57d44789d19e65e39cfd Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 6 Jan 2025 14:36:53 +0100 Subject: [PATCH] Editorial: initialize clearTargets in event dispatch correctly Also clean up "for each" wording while here. Fixes #1344. --- dom.bs | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/dom.bs b/dom.bs index 44de9d21..70816536 100644 --- a/dom.bs +++ b/dom.bs @@ -146,7 +146,7 @@ first following sibling or null if it has no
  • Let tokens be a new ordered set. -

  • For each token in inputTokens, append +

  • For each token of inputTokens, append token to tokens.

  • Return tokens. @@ -894,7 +894,7 @@ correct defaults.

    relative high resolution coarse time given time and event's relevant global object. -
  • For each membervalue in dictionary, if +

  • For each membervalue of dictionary, if event has an attribute whose identifier is member, then initialize that attribute to value. @@ -1305,6 +1305,8 @@ property of the event being dispatched.

  • Let relatedTarget be the result of retargeting event's relatedTarget against target. +

  • Let clearTargets be false. +

  • If target is not relatedTarget or target is event's relatedTarget: @@ -1405,18 +1407,17 @@ property of the event being dispatched.

  • Let clearTargetsStruct be the last struct in event's path whose shadow-adjusted target is non-null. -

  • Let clearTargets be true if clearTargetsStruct's - shadow-adjusted target, clearTargetsStruct's - relatedTarget, or an {{EventTarget}} object in - clearTargetsStruct's touch target list is a node - and its root is a shadow root; otherwise false. +

  • If clearTargetsStruct's shadow-adjusted target, + clearTargetsStruct's relatedTarget, or an {{EventTarget}} object + in clearTargetsStruct's touch target list is a node + whose root is a shadow root: set clearTargets to true.

  • If activationTarget is non-null and activationTarget has legacy-pre-activation behavior, then run activationTarget's legacy-pre-activation behavior.

  • -

    For each struct in event's path, in +

    For each struct of event's path, in reverse order:

      @@ -1431,7 +1432,7 @@ property of the event being dispatched.
  • -

    For each struct in event's path: +

    For each struct of event's path:

    1. If struct's shadow-adjusted target is non-null, then @@ -1591,7 +1592,7 @@ and an optional legacyOutputDidListenersThrowFlag, run these steps:

    2. Let found be false.

    3. -

      For each listener in listeners, whose +

      For each listener of listeners, whose removed is false:

        @@ -4802,7 +4803,7 @@ steps are:
        1. -

          For each attr in node2's +

          For each attr of node2's attribute list:

            @@ -7370,7 +7371,7 @@ steps:
          1. If this {{NamedNodeMap}} object's element is in the HTML namespace and its node document is an HTML document, then - for each name in names: + for each name of names:

            1. Let lowercaseName be name, in ASCII lowercase. @@ -10050,7 +10051,7 @@ method steps are:

              1. -

                For each token in tokens: +

                For each token of tokens:

                1. If token is the empty string, then throw a "{{SyntaxError!!exception}}" @@ -10060,7 +10061,7 @@ method steps are: "{{InvalidCharacterError!!exception}}" {{DOMException}}.

                -
              2. For each token in tokens, append +

              3. For each token of tokens, append token to this's token set.

              4. Run the update steps. @@ -10072,7 +10073,7 @@ method steps are:

                1. -

                  For each token in tokens: +

                  For each token of tokens:

                  1. If token is the empty string, then throw a "{{SyntaxError!!exception}}" @@ -10549,6 +10550,7 @@ Sergey G. Grekhov, Shiki Okasaka, Shinya Kawanaka, Simon Pieters, +Simon Wülker, Stef Busking, Steve Byrne, Stig Halvorsen,