W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] Drag-and-drop feedback

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 22 Feb 2010 23:51:25 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1002222346470.20980@ps20323.dreamhostps.com>
On Thu, 4 Feb 2010, Ian Hickson wrote:
> On Sat, 23 Jan 2010, Eduard Pascual wrote:
> >
> > Would it be possible to provide a list of "drag items" (to call them 
> > somehow) instead of, or in addition to, the current info provided by 
> > the DataTransfer object?
> 
> That's a pretty good idea. I think we should probably do this when we 
> add more types to the DataTransfer object.

Some engineers at Google discussed this a bit and came up with the 
following proposal:

   dataTransfer.items = DataTransferItems

    DataTransferItems.length
                     .getItem(n) = DataTransferItem
                     .add(stringData, type)
                     .add(blobData)
                     .add(fileData)
                     .add(dataTransferItem)
                     .clear()

    DataTransferItem.kind = 'string', 'file', 'blob', ...
                    .type = MIME type
                    .binary = boolean 
                    .getTextData(function callback (data)) - throws if binary is true
                    .getBlob() - returns File or Blob

When we add promises later, this can easily be extended to support that as 
well (basically, just by adding a new add() method for the promise case).

I've put this into the comment in the spec, but haven't specced it. If any 
browser vendors want to try implementing this or something like it, any 
reports of implementation experience would be very useful. Please prefix 
the "items" attribute with some unique string like "webkitItems" or 
"geckoItems" so that it doesn't clash with the spec when we do add 
something like this!

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 22 February 2010 15:51:25 UTC

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