- From: Gijs <notifications@github.com>
- Date: Mon, 08 Jun 2026 10:03:05 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 8 June 2026 17:03:09 UTC
gijsk left a comment (whatwg/dom#1265)
> But the `ancestor` parameter would change closest to do a composed path walk
On its own, I don't see why it would do a composed path walk rather than what it does now.
> Now, as for your suggestion for a CSS boundary condition:
>
> Workaround 1: ID/Selector Swap Hack
>
> ```
> const oldId = currentTarget.id;
> const tempId = "STOP-HERE";
> ev.currentTarget.id = tempId;
>
> // Note: target.closest() is needed here instead of .matches()
> // so it finds buttons above the target element.
> const match = target.closest(`#${tempId} button`);
> currentTarget.id = oldId;
> ```
>
> Adding a boundary condition using selectors DOES NOT force a hard boundary. `closest` STILL climbs, to root. And it clunks.
>
This isn't what I meant, I meant:
```
const match = target.closest(`#${tempId} , button`)
```
Note the additional comma.
You would then need to check if you got back `currentTarget` or a button.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1265#issuecomment-4651387285
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/1265/4651387285@github.com>
Received on Monday, 8 June 2026 17:03:09 UTC