[whatwg] Adding mouseenter and mouseleave events

Křištof Želechovski giecrilj at stegny.2a.pl
Thu May 8 09:53:54 PDT 2008


I have recently developed an application to identify persons pointed at on a
photograph.  When person A stands in front of person B the inquirer moves
from person A to person B, the application becomes unstable: exit A, enter
B, exit B, enter A.  It is rather annoying.  The person behind should be
ignored.  Returning false from the handler does not help.
Chris

-----Original Message-----
From: whatwg-bounces at lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Ian Hickson
Sent: Thursday, May 08, 2008 2:56 AM
To: Magnus Kristiansen
Cc: whatwg at whatwg.org
Subject: Re: [whatwg] Adding mouseenter and mouseleave events

On Thu, 15 Mar 2007, Magnus Kristiansen wrote:
>
> Mouseover/out events will trigger when elements contained inside the
> EventTarget are hovered, and then bubble up. This is contrary to the most
> obvious interpretation, as you are still inside (over) the targeted
element.
> IE supports two events, mouseenter[1] and mouseleave[2], which solve this
> problem by not bubbling.
> 
> It is possible to work around the problem by using target/relatedTarget
and
> walking up the DOM tree. However, this requires extra code for every event
> handler. Besides, these events were often not meant to be generated in the
> first place, by the intent of the author.
> 
> I have no statistics for how often mouseover/out are used with and without
> intent of bubbling, but the anecdotal evidence from my own experience has
> never found me wanting it.
> 
> I suggest these two events be added to the web applications spec.
> 
> [1]
>
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onmouseente
r.asp
> [2]
>
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onmouseleav
e.asp

I recommend sending this feedback to the WebAPI working group, which is 
working on DOM events.

(I shall forward the thread to the working group, but I do not know if the 
WebAPI working group has an effective issue tracking mechanism, so you may 
wish to follow this up to ensure that it gets handled.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'





More information about the whatwg mailing list