Re: [pointerevents] Changing the DOM hierarchy while handling a "pointerenter" event produces significantly different results across browsers (#285)

There are three separate questions here: what's the correct pointer event sequence before/after the node deletion?  And what's the correct compat mouse event sequence here?

[Here](https://codepen.io/mustaqahmed/full/RwpbMVa) is a copy of the same repro reported above.

#### Pointer Event sequence before deletion
I think the core problem here is that we don't know how deleted nodes should affect the repeated dispatch of `mouseenter`/`mouseleave` events.  We are talking about the scenario mentioned below Figure 3 in [UI Events Spec](https://w3c.github.io/uievents/#events-mouseevent-event-order).  The spec is silent about how the event dispatch works for deleted child nodes, and the silence is understandable because it is impossible to specify every possible corner cases.  So any of the following interpretations are valid (and there can be more):
- "Middle" and "bottom" shouldn't receive any events because they were deleted by the "top" event handler which was executed first.  No browsers follow this.
- "Middle" and "bottom" should receive all `pointerenter` and `pointerleave` events because the events were dispatched before "top" event handler started executing.  All browsers follow this, so let's not worry about it.

#### Pointer Event sequence after deletion
The deleted nodes receive `pointerleave` events in Firefox and Safari, and not in Chrome.  I think UI Events Spec doesn't say anything so we can ignore this too.

But all three browsers see an extra `pointerenter` at "top" after the deletion and that is clearly wrong: "top" shouldn't see two consecutive `pointerenter` without a `pointerleave` in-between.

### Compat mouse events
As Navid [pointed out](https://github.com/w3c/pointerevents/issues/285#issuecomment-725542204): we agreed that the compat mouse events should be fired in a way that makes the whole stream of compat events sensible in a multi-pointer scenario.  If we have a correct pointer event sequence (last two points above), this should follow from #35 discussion.

-- 
GitHub Notification of comment by mustaqahmed
Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/285#issuecomment-832235942 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 4 May 2021 20:49:39 UTC