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

[whatwg] Drag and drop: bugged implementation of setting drag feedback with setDragImage?

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 26 Jan 2012 23:08:24 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1201262305040.16982@ps20323.dreamhostps.com>
On Thu, 29 Sep 2011, Rafa?~B Mi?~Becki wrote:
>
> I've a question regarding setDragImage. I've implemented "dragstart" 
> event handler in the following way:
> 
> event.setDragImage(this, 0, 0);
> this.style.background = 'yellow';
> 
> What do I expect:
> 1) Origin element to have yellow background
> 2) Drag feedback element (the one under cursor) to have original background
> 
> Are my expectations correct?

Sort of. The spec doesn't say that the drag image needs to exactly match 
the element, so technically browsers are allowed to set the bitmap to 
what the element will look like at some time in the future... But yeah, in 
principle, what you describe is correct.


> Because Webkit and Gecko implementation doesn't match it. In their cases 
> both elements have modified background. It seems that both engines delay 
> setting drag image until the end of event handler.

On Fri, 30 Sep 2011, Daniel Cheng wrote:
>
> The reason it works that way is inside the dragstart handler, when you 
> call setDragImage, we merely retain a reference to the element you 
> passed in. We don't actually create the drag image until after dragstart 
> processing is finished.

Makes sense.

Seems more useful to support what Rafal is trying to do, though, so I 
haven't currently changed the spec for this.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 26 January 2012 15:08:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:39 UTC