- From: Daniel Cheng <dcheng@google.com>
- Date: Mon, 22 Feb 2010 18:06:08 -0800
Several questions about the proposal: How does DataTransferItems interact with the original DataTransfer object? I'm assuming changes in one should be reflected in the other. If that's the case, what should happen if I do this: dataTransfer.items.add(fileData); dataTransfer.getData(mimeTypeForFile); How come there's no DataTransferItems.get(type) method? DataTransferItem provides richer metadata than is available through the native drag-and-drop interface on most platforms. When dragging data from a non-DOM application, how do you extrapolate the metadata to fill in the type/binary fields? Daniel On Mon, Feb 22, 2010 at 3:51 PM, Ian Hickson <ian at hixie.ch> wrote: > 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. `._.-(,_..'--(,_..'`-.;.' > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100222/66897caa/attachment-0001.htm>
Received on Monday, 22 February 2010 18:06:08 UTC