[whatwg] Drag-and-drop feedback
Ian Hickson
ian at hixie.ch
Mon Feb 22 15:51:25 PST 2010
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. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list