hixie: Add dataTransfer.files for drag-and-drop. Not sure how to expose it during the drags yet, though. (whatwg r3547)

hixie: Add dataTransfer.files for drag-and-drop. Not sure how to expose
it during the drags yet, though. (whatwg r3547)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2741&r2=1.2742&f=h
http://html5.org/tools/web-apps-tracker?from=3546&to=3547

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2741
retrieving revision 1.2742
diff -u -d -r1.2741 -r1.2742
--- Overview.html 6 Aug 2009 09:04:53 -0000 1.2741
+++ Overview.html 6 Aug 2009 09:24:36 -0000 1.2742
@@ -50164,10 +50164,13 @@
   </div><pre class="idl">interface <dfn id="datatransfer">DataTransfer</dfn> {
            attribute DOMString <a href="#dom-datatransfer-dropeffect" title="dom-DataTransfer-dropEffect">dropEffect</a>;
            attribute DOMString <a href="#dom-datatransfer-effectallowed" title="dom-DataTransfer-effectAllowed">effectAllowed</a>;
+
   readonly attribute DOMStringList <a href="#dom-datatransfer-types" title="dom-DataTransfer-types">types</a>;
   void <a href="#dom-datatransfer-cleardata" title="dom-DataTransfer-clearData">clearData</a>([Optional] in DOMString format);
   void <a href="#dom-datatransfer-setdata" title="dom-DataTransfer-setData">setData</a>(in DOMString format, in DOMString data);
   DOMString <a href="#dom-datatransfer-getdata" title="dom-DataTransfer-getData">getData</a>(in DOMString format);
+  readonly attribute <span>FileList</span> <a href="#dom-datatransfer-files" title="dom-DataTransfer-files">files</a>;
+
   void <a href="#dom-datatransfer-setdragimage" title="dom-DataTransfer-setDragImage">setDragImage</a>(in Element image, in long x, in long y);
   void <a href="#dom-datatransfer-addelement" title="dom-DataTransfer-addElement">addElement</a>(in Element element);
 };</pre><p><code><a href="#datatransfer">DataTransfer</a></code> objects can hold pieces of data, each
@@ -50235,6 +50238,14 @@
 
    </dd>
 
+   <dt><var title="">dataTransfer</var> . <code title="dom-DataTransfer-files"><a href="#dom-datatransfer-files">files</a></code></dt>
+
+   <dd>
+
+    <p>Returns a <code>FileList</code> of the files being dragged, if any.</p>
+
+   </dd>
+
    <dt><var title="">dataTransfer</var> . <code title="dom-DataTransfer-setDragImage"><a href="#dom-datatransfer-setdragimage">setDragImage</a></code>(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>)</dt>
 
    <dd>
@@ -50317,6 +50328,12 @@
   is but it has no URLs, then the method must return the empty
   string. <a href="#references">[RFC2483]</a></p>
 
+  <p>The <dfn id="dom-datatransfer-files" title="dom-DataTransfer-files"><code>files</code></dfn>
+  attribute must return the <code>FileList</code> object that contains
+  the files that are stored in the <code><a href="#datatransfer">DataTransfer</a></code>
+  object. There is one such object per <code><a href="#datatransfer">DataTransfer</a></code>
+  object.</p>
+
   <p>The <dfn id="dom-datatransfer-setdragimage" title="dom-DataTransfer-setDragImage"><code>setDragImage(<var title="">element</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method sets which element to use <a href="#base-dnd-feedback">to generate the drag feedback</a>. The
   <var title="">element</var> argument can be any
   <code>Element</code>; if it is an <code><a href="#the-img-element">img</a></code> element, then the
@@ -50349,7 +50366,7 @@
      <th> Target </th>
      <th> Bubbles? </th>
      <th> Cancelable? </th>
-     <th> <code title="dom-DataTransfer-addElement"><a href="#dom-datatransfer-addelement">dataTransfer</a></code> </th>
+     <th> <code title="dom-DataTransfer-dataTransfer">dataTransfer</code> </th>
      <th> <code title="dom-DataTransfer-effectAllowed"><a href="#dom-datatransfer-effectallowed">effectAllowed</a></code> </th>
      <th> <code title="dom-DataTransfer-dropEffect"><a href="#dom-datatransfer-dropeffect">dropEffect</a></code> </th>
      <th> Default Action </th>
@@ -50397,7 +50414,7 @@
      <td><a href="#current-target-element">Current target element</a></td>
      <td>&#10003; Bubbles</td>
      <td>&#10003; Cancelable</td>
-     <td><code>getData()</code> returns data set in <code title="dom-dragstart">dragstart</code> event</td>
+     <td><code title="dom-datatransfer-getdata"><a href="#dom-datatransfer-getdata">getData()</a></code> returns data set in <code title="dom-dragstart">dragstart</code> event; <code title="dom-datatransfer-files"><a href="#dom-datatransfer-files">files</a></code> returns any files included in the drag operation</td>
      <td><a href="#effectAllowed-initialization">Same as last event</a></td>
      <td><a href="#current-drag-operation">Current drag operation</a></td>
      <td>Varies</td>
@@ -50495,11 +50512,12 @@
   <a href="#list-of-dragged-nodes">list of dragged nodes</a> contains only the <a href="#source-node">source
   node</a>.</p>
 
-  <hr><p>If it is a selection that is being dragged, the <code title="dom-DragEvent-dataTransfer"><a href="#dom-dragevent-datatransfer">dataTransfer</a></code> member of the event
-  must be created with no nodes. Otherwise, it must be created
+  <hr><p>If it is a selection that is being dragged, the <code title="dom-DragEvent-dataTransfer"><a href="#dom-dragevent-datatransfer">dataTransfer</a></code> member of the
+  event must be created with no nodes. Otherwise, it must be created
   containing just the <a href="#source-node">source node</a>. Script can use the
   <code title="dom-DataTransfer-addElement"><a href="#dom-datatransfer-addelement">addElement()</a></code> method
-  to add further elements to the list of what is being dragged.</p>
+  to add further elements to the list of what is being dragged. (This
+  list is only used for rendering the drag feedback.)</p>
 
   <p>The <code title="dom-DragEvent-dataTransfer"><a href="#dom-dragevent-datatransfer">dataTransfer</a></code>
   member of the event also has data added to it, as follows:</p>
@@ -50514,6 +50532,18 @@
 
    <li>
 
+    <p>If files are being dragged, then the user agent must add the
+    files to the <code title="dom-DragEvent-dataTransfer"><a href="#dom-dragevent-datatransfer">dataTransfer</a></code> member's
+    <code title="dom-datatransfer-files"><a href="#dom-datatransfer-files">files</a></code> attribute's
+    <code>FileList</code> object. (Dragging files can only happen from
+    outside a <a href="#browsing-context">browsing context</a>, for example from a file
+    system manager application, and thus the <code title="event-dragstart"><a href="#event-dragstart">dragstart</a></code> event is actually implied
+    in this case.)</p>
+
+   </li>
+
+   <li>
+
     <p>The user agent must take the <a href="#list-of-dragged-nodes">list of dragged nodes</a>
     and <a href="#extracting-json" title="extracting JSON">extract the microdata from those
     nodes into a JSON form</a>, and then must add the resulting
@@ -50829,7 +50859,9 @@
       must be given the value representing the <a href="#current-drag-operation">current drag
       operation</a> (<code title="">copy</code>, <code title="">link</code>, or <code title="">move</code>), and the
       object must be set up so that the <code title="dom-DataTransfer-getData"><a href="#dom-datatransfer-getdata">getData()</a></code> method will
-      return the data that was added during the <code title="event-dragstart"><a href="#event-dragstart">dragstart</a></code> event.</p>
+      return the data that was added during the <code title="event-dragstart"><a href="#event-dragstart">dragstart</a></code> event, and the <code title="dom-datatransfer-files"><a href="#dom-datatransfer-files">files</a></code> attribute will
+      return a <code>FileList</code> object with any files that were
+      dragged.</p>
 
       <p>If the event is canceled, the <a href="#current-drag-operation">current drag
       operation</a> must be set to the value of the <code title="dom-DataTransfer-dropEffect"><a href="#dom-datatransfer-dropeffect">dropEffect</a></code> attribute

Received on Thursday, 6 August 2009 09:25:34 UTC