Re: [whatwg/dom] Pass the Window document when finishing event timing (PR #1529)

noamr left a comment (whatwg/dom#1529)

Good catch! Yes, when w3c/long-animation-frames#39 fixed `start recording task time if needed` to unwrap `relevant settings object`'s `global object` (`Window`) → `associated Document`, the matching end step in `fire an event` from #1462 was missed.

Rather than having `fire an event` unwrap `Window` / `associated Document` and pass `unsafe shared current time` to `record task end time` directly, it's cleaner to keep that in Long Animation Frames by having `start recording task time if needed` return null or cleanup steps (closing over the root `Document` and `unsafe shared current time`), e.g.:

```html
 <li><p>Let <var>endTaskTime</var> be the result of calling
 <a>start recording task time if needed</a> given <var>target</var>'s
 <a>relevant settings object</a>.
...
 <li><p>If <var>endTaskTime</var> is not null, then run <var>endTaskTime</var>.
```

This also avoids a subtle edge case where `target`'s `<iframe>` is detached during `dispatch` (which would otherwise change `nearest same-origin root` before `record task end time` runs).

I've opened w3c/long-animation-frames#50 to update `start recording task time if needed` accordingly; once that lands, we can update this PR to call `endTaskTime` directly.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1529#issuecomment-7104217102
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1529/c7104217102@github.com>

Received on Monday, 23 November 2026 14:35:47 UTC