[whatwg] Drag-and-drop feedback

Ian Hickson ian at hixie.ch
Thu Feb 4 18:33:16 PST 2010

On Thu, 4 Feb 2010, Daniel Cheng wrote:
> On Thu, Feb 4, 2010 at 5:28 PM, Ian Hickson <ian at hixie.ch> wrote:
> > On Thu, 4 Feb 2010, Daniel Cheng wrote:
> > > >
> > > > Webkit and Firefox are case-sensitive. IE only does "TEXT" and 
> > > > "URL", but case-insensitively (at least for Text, I didn't test 
> > > > URL). Chrome is case-insensitive for everything.
> > > >
> > > > Tough call. I guess we'll go with just converting everything to 
> > > > lowercase, so that it's case-insensitive.
> > > >
> > > > BTW I noticed Chrome includes "Text" and "URL" in the .types list. 
> > > > That's incorrect according to the spec.
> > >
> > > If event.dataTransfer converts everything to lowercase, that means 
> > > there are native formats that will always be impossible to access.
> >
> > The spec requires that the UA lowercase all the native types as well 
> > (and that they be converted to MIME types).
> >
> > Could you elaborate on which types would be a problem, and on what 
> > platforms?
> Forcing UA to lowercase all formats has a high implementation cost.

It's not _that_ high. It's just a few strings, and it's easily cachable.

> Most DataTransfer implementations now can directly interact with the 
> native system data object, whatever form that takes. With this change, 
> the UA has to enumerate (with possible string conversions involved, 
> depending on the platform) and lower case all formats currently in the 
> drag and drop/clipboard operation with every call to 
> getData()/setData()/clearData(). Furthermore, what happens if there are 
> collisions after lowercasing?

The spec requires that the UA convert the formats to MIME types, so the UA 
is responsible for preventing collisions.

> Also, suppose some Windows app XYZ uses the data format "My Awesome 
> Clipboard Format". If a page wants to set drag and drop (or clipboard 
> data; presumably, the interfaces to transfer data are going to remain 
> somewhat similar), it will be unable to set data in the correct format 
> unless the UA happens to internally map a MIME type to that data format.


> Some common MIME types should definitely be mapped to native data 
> formats, but the interface shouldn't prevent someone from interfacing 
> with any arbitrary app they want.

I'm open to changing this again, but if it is to change again I want to 
make sure we never change it after that, so we need to be very sure about 
what the spec should say here.

Exactly what conversions should happen? When?

If you could work with other browser vendors to come up with the exact 
rules for dataTransfer that everyone agrees makes sense on every platform, 
that would be ideal.

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