W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2012

[whatwg] Comparing mouseover/mouseout, mouseenter/mouseleave and dragenter/dragleave

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 10 Jan 2012 22:42:59 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1201102238210.14154@ps20323.dreamhostps.com>
On Sun, 12 Jun 2011, Rob Crowther wrote:
>
> In Firefox 4 dragenter/dragleave are fired like mouseover/mouseout 
> events - when you enter or leave the elements irrespective of whether 
> the mouse pointer is entering a child element or leaving the element 
> altogether.  So I have two questions:
> 
> 1. Is Firefox 4 doing the correct thing?

Per the spec, dragenter is fired whenever the immediate user selection 
changes, even if it is changed to a descendant of the previous one, and
dragleave is fired whenever the current target element was changed as a 
result of dragenter firing.


> 2. If it is doing the correct thing, isn't it a bit confusing that 
> dragenter doesn't behave like mouseenter but like mouseover and 
> dragleave doesn't behave like mouseleave but mouseout?

The drag-and-drop model is quite confusing in general, independant of 
whether it matches one or another of the mouse event mechanisms.


> The phrase "Fire a DND event named dragenter at the immediate user 
> selection" seems to indicate Firefox is correct, but it wasn't the 
> behaviour I was expecting when I tried it for the first time.

Yeah, this API is quite unintuitive. I've tried to make it less relevant 
by adding draggable="" and dropzone="", and you can ignore descendant 
elements by relying on bubbling, both of which help a little, but at the 
end of the day we're pretty much stuck with what Microsoft invented back 
in the late 90s in COM, which is what this is originally based on, if I'm 
not mistaken.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 10 January 2012 14:42:59 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:10 UTC