-
Notifications
You must be signed in to change notification settings - Fork 51
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
Need clarification how mouseenter/leave should behave while modifying DOM tree during event dispatch #244
Comments
@garykac, any comments? |
I wrote up a proposed algorithm for handling mouse events, but I haven't yet thought deeply about the best way to handle DOM mutations. The proposed algorithm ensures that every element that receives a WRT the Naively, I would have guessed either:
Or possibly simply (if the elements are removed before any events are sent):
The first example most closely matches Safari except the the extra mouse/pointerenter at the end. It's odd that all browsers generate the unnecessary "pointerenter top" at the end. |
On this mouseevents test page, if you enter from the right side (where the 3 divs align), you do get 3 It's a bit concerning that Chrome/Firefox apparently have different paths for the corresponding mouse and pointer events. Even if you ignore the DOM mutation, Safari interleaves the mouse/pointer events while Chome/Firefox group each type together. I think that interleaving them is more appropriate if we expect mouse and pointer events to be somewhat interchangeable. |
Another note: need to test DOM manipulations during Capture vs. AtTarget vs. Bubbling. |
The problem with interleaving is that enter/leave happen because of reaction to some *over/*out. So if mouseover is dispatched, there should be corresponding mouseenter events. But I think whether or not to interleave should be left to w3c/pointerevents#285 or some other pointer events spec issue. But for the overall enter/leave handling, the main worry I have is that leave event might happen way way after the element has been removed. If some script removes the element under the cursor when pointer isn't moving, there won't be any events, but then later when pointer is moved, you'd get *leave for the removed elements. |
That works for me. I just need to know which way we go so that I can add appropriate hooks into the proposed algorithm. I've added a note to the doc with a link to that PE issue. |
It isn't clear which elements should get mouseenter/leave events if DOM is modified during dispatching one of the events.
Pointer events variant of this bug is w3c/pointerevents#285
The text was updated successfully, but these errors were encountered: