[whatwg] Adding mouseenter and mouseleave events
magnusrk+whatwg at pvv.org
Wed Mar 14 17:30:13 PDT 2007
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 and mouseleave, 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.
"Don't worry; the Universe IS out to get you."
More information about the whatwg