Re: [whatwg/dom] Add before removing steps (PR #1185)

> Except for popover we handle all of those in DOM directly. Should we really make that an extension point? Is there some other way to design popover?

We could call hide popover from the DOM spec instead of exposing an extension point.

I did [some investigation](https://chromium-review.googlesource.com/c/chromium/src/+/4470968) and it actually turns out that chromium doesn't exactly run hide popover before removal, but does it at an intermediate stage where the state looks like this:
- The popover element's [parent](https://dom.spec.whatwg.org/#concept-tree-parent) is null.
- The popover element's [connected flag](https://dom.spec.whatwg.org/#connected) is true.

I'm not sure if this state can exist in the spec because step 11 of the [removing steps](https://dom.spec.whatwg.org/#concept-node-remove) probably atomically removes the parent and sets the connected flag to false - chromium has separate state for these.

The reason that chromium does this is because it turns out that we don't truly have a hook for before removing steps on any node, at least not yet. Mason told me that this is basically close enough to truly running hide popover before removal though, and I agree. If that's not the case, then we can change it in chromium.

I tried [calling hide popover after removal instead of before](https://chromium-review.googlesource.com/c/chromium/src/+/4577762), but it caused 7 different WPTs to fail. I think that if we shouldn't add an extension, then we should call hide popover from the DOM spec at the right place before removal.

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

Message ID: <whatwg/dom/pull/1185/c1570923537@github.com>

Received on Wednesday, 31 May 2023 20:43:13 UTC