Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOM integration] No state is reset on node removal #526

Closed
domfarolino opened this issue Nov 5, 2024 · 3 comments
Closed

[DOM integration] No state is reset on node removal #526

domfarolino opened this issue Nov 5, 2024 · 3 comments

Comments

@domfarolino
Copy link
Member

Nothing in the specification seems to explicitly reset pointer event state for an element, that would make hasPointerCapture() return false after an element is removed from the DOM, I think. I would expect this specification to hook into DOM's removing steps to reset some state when an element that has pointer capture is removed.

We came across this in the process of working on whatwg/dom#1307, and have this test: https://github.com/web-platform-tests/wpt/blob/master/dom/nodes/moveBefore/tentative/pointer-events.html

@mustaqahmed
Copy link
Member

As per this text, the document becomes the capture target so hasPointerCapture() would still return true I believe.

@smaug----
Copy link
Contributor

hasPointerCapture() would return false, because of https://w3c.github.io/pointerevents/#dom-element-haspointercapture
The spec is quite clear even though it is not using the removing steps. It explicitly says what happens when element isn't connected anymore. (but the relevant part should probably use MUST, not SHOULD)

@domfarolino
Copy link
Member Author

OK, I think I found it. The text here: https://w3c.github.io/pointerevents/#ref-for-dfn-pending-pointer-capture-target-override-8 mentions that the pending pointer capture target override should be cleared when it is no longer connected to the DOM, which would make hasPointerCapture() return false on the disconnected element, and still true on a moveBefore()'d element (since it never becomes disconnected). Thank you! I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants