Re: Question about implementing DataTransfer.addElement

On Fri, 7 Oct 2011, Daniel Cheng wrote:
>
> What's the difference between addElement and setDragImage()?
> 
> The spec says:
> 
> > The difference between setDragImage() and addElement() is that the 
> > latter automatically generates the image based on the current 
> > rendering of the elements added (potentially keeping it updated as the 
> > drag continues, e.g. if the elements include an actively playing 
> > video), whereas the former uses the exact specified image at the time 
> > the method is invoked.
> 
> For technical reasons, animating the drag image is non-trivial and not 
> likely to be implemented in the near future, if it is ever implemented. 
> However, if we don't implement dynamic drag image updates, doesn't that 
> make it essentially the same as setDragImage()? In that case, what's the 
> point of having addElement(); wouldn't it make more sense to just remove 
> it rather than having two different ways of doing the same thing?

The parenthetical isn't the important part (that's why it's 
parenthetical). The important difference between setDragImage() and 
addElement() is that the latter automatically generates the image based on 
the current rendering of the elements added whereas the former uses the 
exact specified image. So for example if the user is dragging an element 
with some complicated CSS styles, that's what gets drawn with 
addElement(), whereas the author has no sane way of providing an image 
that contains equivalent pixels.

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

Received on Monday, 10 October 2011 22:30:25 UTC