- From: Maciej Stachowiak <mjs@apple.com>
- Date: Thu, 30 Jul 2009 23:01:26 -0700
- To: Jonas Sicking <jonas@sicking.cc>
- Cc: Jacob Rossi <t-jacobr@microsoft.com>, "www-dom@w3.org" <www-dom@w3.org>, Travis Leithead <travil@microsoft.com>
On Jul 30, 2009, at 9:33 PM, Jonas Sicking wrote: > On Thu, Jul 30, 2009 at 3:26 PM, Jacob Rossi<t-jacobr@microsoft.com> > wrote: >> >> My suggestion: >> mouseenter >> "A pointing device is moved over the boundaries of an element _or_ >> one of its children. This event type is similar to mouseover, but >> does not bubble. Note: This is the event type equivalent of the >> CSS :hover pseudo-class [CSS2]." >> >> mouseleave >> "A pointing device is moved outside of the boundaries of an element >> _and_ its children. This event type differs from mouseout in that >> it does not fire until the pointing device has left the boundaries >> of the element and all of its children; whereas mouseout fires on >> an element when the pointing device moves over one of its children. If I understand mouseenter and mouseleave correctly, the basic idea is that you get exactly one of the appropriate event when the mouse enters or leaves your element's boundaries, even if it goes directly into or out of a child element, but you won't keep getting them for mouse motion inside your element. So effectively they go up the hierarchy, but by dispatching separate events at every crossed element boundary, rather than by bubbling. I think these descriptions are still somewhat ambiguous because they don't make these points really clear. > > Why do we need mouseenter/mouseleave at all? It seems to me that > mouseover/mouseout is more widely deployed in UAs, and solves the same > use cases. Despite my general distaste for multiple events for the same action, I actually think mouseenter/mouseleave are quite valuable. There's no need to carefully filter out the bubbled enter/leave events, so it's easier to write code that does the right thing in an efficient way. mouseover/mouseout have a trickier and more error-prone design. Regards, Maciej
Received on Friday, 31 July 2009 06:02:07 UTC