<div>Several questions about the proposal:</div>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:<div>
dataTransfer.items.add(fileData);</div><div>dataTransfer.getData(mimeTypeForFile);</div><div><div><div><div><div><br></div><div>How come there's no DataTransferItems.get(type) method?</div><div><br></div><div>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?</div>
<div><br></div><div>Daniel<br><br><div class="gmail_quote">On Mon, Feb 22, 2010 at 3:51 PM, Ian Hickson <span dir="ltr"><<a href="mailto:ian@hixie.ch" target="_blank">ian@hixie.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Thu, 4 Feb 2010, Ian Hickson wrote:<br>
> On Sat, 23 Jan 2010, Eduard Pascual wrote:<br>
> ><br>
> > Would it be possible to provide a list of "drag items" (to call them<br>
> > somehow) instead of, or in addition to, the current info provided by<br>
> > the DataTransfer object?<br>
><br>
> That's a pretty good idea. I think we should probably do this when we<br>
> add more types to the DataTransfer object.<br>
<br>
</div>Some engineers at Google discussed this a bit and came up with the<br>
following proposal:<br>
<br>
dataTransfer.items = DataTransferItems<br>
<br>
DataTransferItems.length<br>
.getItem(n) = DataTransferItem<br>
.add(stringData, type)<br>
.add(blobData)<br>
.add(fileData)<br>
.add(dataTransferItem)<br>
.clear()<br>
<br>
DataTransferItem.kind = 'string', 'file', 'blob', ...<br>
.type = MIME type<br>
.binary = boolean<br>
.getTextData(function callback (data)) - throws if binary is true<br>
.getBlob() - returns File or Blob<br>
<br>
When we add promises later, this can easily be extended to support that as<br>
well (basically, just by adding a new add() method for the promise case).<br>
<br>
I've put this into the comment in the spec, but haven't specced it. If any<br>
browser vendors want to try implementing this or something like it, any<br>
reports of implementation experience would be very useful. Please prefix<br>
the "items" attribute with some unique string like "webkitItems" or<br>
"geckoItems" so that it doesn't clash with the spec when we do add<br>
something like this!<br>
<br>
Cheers,<br>
<div><div></div><div>--<br>
Ian Hickson U+1047E )\._.,--....,'``. fL<br>
<a href="http://ln.hixie.ch/" target="_blank">http://ln.hixie.ch/</a> U+263A /, _.. \ _\ ;`._ ,.<br>
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'<br>
</div></div></blockquote></div><br></div></div></div></div></div>