Browse files

[giow] (0) dropzone 4/5, part 2/2: DataTransferItem.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10712

git-svn-id: http://svn.whatwg.org/webapps@5651 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent 36a7873 commit bf0d7487f6e2672b05476aac5939b2048185c544 @Hixie Hixie committed Oct 29, 2010
Showing with 901 additions and 271 deletions.
  1. +291 −93 complete.html
  2. +291 −93 index
  3. +319 −85 source
View
384 complete.html
@@ -65723,7 +65723,7 @@ <h3 id=spelling-and-grammar-checking><span class=secno>8.6 </span>Spelling and g
<h3 id=dnd><span class=secno>8.7 </span><dfn>Drag and drop</dfn></h3>
-<!-- v2 ideas for drag and drop:
+<!-- v2: ideas for drag and drop:
* being able to animate a drop target:
@@ -65761,9 +65761,17 @@ <h3 id=dnd><span class=secno>8.7 </span><dfn>Drag and drop</dfn></h3>
Ack: Ben Laurie (@g)
- * Promises. Should be able to say "if you accept this drop, then
- I can provide the File object that corresponds to it
- eventually".
+ Other things listed below:
+ DND-v2: more native support: text/html from selections, etc
+ DND-v3: add Blob support
+ DND-v4: add structured clone support
+ DND-v5: add promises (should be able to say "if you accept this
+ drop, then I can provide the File object that
+ corresponds to it eventually")
+
+ DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
+ .onneeddata - can wait until this fires to provide data
+ .setData() - call this once you have data, must be the right type
-->
@@ -65917,21 +65925,7 @@ <h4 id=the-drag-data-store><span class=secno>8.7.2 </span>The drag data store</h
items representing the dragged data, each consisting of the
following information:</p>
- <dl><dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn></dt>
-
- <dd>
-
- <p>A Unicode string giving the type or format of the data,
- generally given by a <a href=#mime-type>MIME type</a>. Some values that
- are not <a href=#mime-type title="MIME type">MIME types</a> are
- special-cased for legacy reasons. The API does not enforce the
- use of <a href=#mime-type title="MIME type">MIME types</a>; other values
- can be used as well. In all cases, however, the values are all
- <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> by the API.</p>
-
- </dd>
-
- <dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn></dt>
+ <dl><dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn></dt>
<dd>
@@ -65942,17 +65936,19 @@ <h4 id=the-drag-data-store><span class=secno>8.7.2 </span>The drag data store</h
<p>Text.</p>
</dd>
+<!-- DND-v3:
<dt><i>Blob</i></dt>
<dd>
<p>Binary data.</p>
</dd>
+-->
<dt><i>File</i></dt>
<dd>
<p>Binary data with a file name.</p>
</dd>
-<!-- v2:
+<!-- DND-v4:
<dt><i>Structured object</i></dt>
<dd>
<p>An object that will be cloned using the <span>structured clone</span> algorithm.</p>
@@ -65961,13 +65957,31 @@ <h4 id=the-drag-data-store><span class=secno>8.7.2 </span>The drag data store</h
</dl></dd>
+ <dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn></dt>
+
+ <dd>
+
+ <p>A Unicode string giving the type or format of the data,
+ generally given by a <a href=#mime-type>MIME type</a>. Some values that
+ are not <a href=#mime-type title="MIME type">MIME types</a> are
+ special-cased for legacy reasons. The API does not enforce the
+ use of <a href=#mime-type title="MIME type">MIME types</a>; other values
+ can be used as well. In all cases, however, the values are all
+ <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> by the API.</p>
+
+ </dd>
+
<dt>The actual data</dt>
<dd><p>A Unicode or binary string, optionally with a file name
- (itself a Unicode string), <!-- (v2:) or an object, --> as per
+ (itself a Unicode string), <!-- (DND-v4:) or an object, --> as per
<a href=#the-drag-data-item-kind>the drag data item kind</a>.</dd>
- </dl></li>
+ </dl><p>The <a href=#drag-data-store-item-list>drag data store item list</a> is ordered in the
+ order that the items were added to the list; most recently added
+ last.</p>
+
+ </li>
<li>
@@ -66325,10 +66339,10 @@ <h4 id=the-datatransfer-interface><span class=secno>8.7.3 </span>The <code><a hr
<li><p>For each item in the <a href=#drag-data-store-item-list>drag data store item list</a>
<!-- in some order...? --> whose <a href=#the-drag-data-item-kind title="the drag data item
- kind">kind</a> is <i>File</i> (not <i>Blob</i>), add the item's
- data (the file, in particular its name and contents, as well as its
- <a href=#the-drag-data-item-type-string title="the drag data item type string">type</a>) to the
- list <var title="">L</var>.</li>
+ kind">kind</a> is <i>File</i> <!-- DND-v3: (not <i>Blob</i>) -->,
+ add the item's data (the file, in particular its name and contents,
+ as well as its <a href=#the-drag-data-item-type-string title="the drag data item type
+ string">type</a>) to the list <var title="">L</var>.</li>
<!-- <li><p>Sort the list...?</p></li> -->
@@ -66396,16 +66410,15 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
<pre class=idl>interface <dfn id=datatransferitems>DataTransferItems</dfn> {
readonly attribute unsigned long <a href=#dom-datatransferitems-length title=dom-DataTransferItems-length>length</a>;
- <a href=#dom-datatransferitems-item title=dom-DataTransferItems-item>getter</a> <span>DataTransferItem</span> (in unsigned long index);
+ <a href=#dom-datatransferitems-item title=dom-DataTransferItems-item>getter</a> <a href=#datatransferitem>DataTransferItem</a> (in unsigned long index);
<a href=#dom-datatransferitems-removeitem title=dom-DataTransferItems-removeItem>deleter</a> void (in unsigned long index);
void <a href=#dom-datatransferitems-clear title=dom-DataTransferItems-clear>clear</a>();
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in DOMString data, in DOMString type);
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in <span>Blob</span> data);
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in <span>File</span> data);
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in <span>DataTransferItem</span> data);<!--
-v2: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in any data, in DOMString type);--><!--
-v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferPromise</span> data);-->
+ <a href=#datatransferitem>DataTransferItem</a> <a href=#dom-datatransferitems-add title=dom-DataTransferItems-add>add</a>(in DOMString data, in DOMString type);<!--
+DND-v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>Blob</span> data);-->
+ <a href=#datatransferitem>DataTransferItem</a> <a href=#dom-datatransferitems-add title=dom-DataTransferItems-add>add</a>(in <span>File</span> data);<!--
+DND-v4: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in any data, in DOMString type);--><!--
+DND-v5: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferPromise</span> data);-->
};</pre>
<dl class=domintro><dt><var title="">items</var> . <code title=dom-DataTransferItems-length><a href=#dom-datatransferitems-length>length</a></code></dt>
@@ -66417,7 +66430,7 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
<dd>
- <p>Returns the <code>DataTransferItem</code> object representing the <var title="">index</var>th entry in the <a href=#drag-data-store>drag data store</a>.</p>
+ <p>Returns the <code><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var title="">index</var>th entry in the <a href=#drag-data-store>drag data store</a>.</p>
</dd>
@@ -66440,13 +66453,13 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
</dd>
- <dt><var title="">items</var> . <code title=dom-DataTransferItems-add>add</code>(<var title="">data</var>)</dt>
- <dt><var title="">items</var> . <code title=dom-DataTransferItems-add>add</code>(<var title="">data</var>, <var title="">type</var>)</dt>
+ <dt><var title="">items</var> . <code title=dom-DataTransferItems-add><a href=#dom-datatransferitems-add>add</a></code>(<var title="">data</var>)</dt>
+ <dt><var title="">items</var> . <code title=dom-DataTransferItems-add><a href=#dom-datatransferitems-add>add</a></code>(<var title="">data</var>, <var title="">type</var>)</dt>
<dd>
<p>Adds a new entry for the given data to the <a href=#drag-data-store>drag data
- store</a>. If the data is plain text <!-- v2: or an object -->
+ store</a>. If the data is plain text <!-- DND-v4: or an object -->
then a <var title="">type</var> string has to be provided
also.</p>
@@ -66461,12 +66474,12 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
When the <code><a href=#datatransferitems>DataTransferItems</a></code> object's
<code><a href=#datatransfer>DataTransfer</a></code> object is <em>not</em> associated with a
<a href=#drag-data-store>drag data store</a>, the <code><a href=#datatransferitems>DataTransferItems</a></code>
- object's <i>mode</i> is <i>disabled mode</i>. The <a href=#drag-data-store>drag data
- store</a> referenced in this section (which is used only when the
- <code><a href=#datatransferitems>DataTransferItems</a></code> object is not in the <i>disabled
- mode</i>) is the <a href=#drag-data-store>drag data store</a> with which the
- <code><a href=#datatransferitems>DataTransferItems</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
- object is associated.</p>
+ object's <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store>drag
+ data store</a> referenced in this section (which is used only
+ when the <code><a href=#datatransferitems>DataTransferItems</a></code> object is not in the
+ <i>disabled mode</i>) is the <a href=#drag-data-store>drag data store</a> with which
+ the <code><a href=#datatransferitems>DataTransferItems</a></code> object's
+ <code><a href=#datatransfer>DataTransfer</a></code> object is associated.</p>
<p>The <dfn id=dom-datatransferitems-length title=dom-DataTransferItems-length><code>length</code></dfn>
attribute must return zero if the object is in the <i>disabled
@@ -66485,7 +66498,11 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
<p>To <dfn id=dom-datatransferitems-item title=dom-DataTransferItems-item>determine the value of
an indexed property</dfn> <var title="">i</var> of a
<code><a href=#datatransferitems>DataTransferItems</a></code> object, the user agent must return a
- <code>DataTransferItem</code> object representing the <var title="">i</var>th item in the <a href=#drag-data-store>drag data store</a>.</p>
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var title="">i</var>th item in the <a href=#drag-data-store>drag data store</a>. The
+ same object must be returned each time. The
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object must be associated with the
+ same <code><a href=#datatransfer>DataTransfer</a></code> object as the
+ <code><a href=#datatransferitems>DataTransferItems</a></code> object when it is created.</p>
<p>To <dfn id=dom-datatransferitems-removeitem title=dom-DataTransferItems-removeItem>delete an
existing indexed property</dfn> <var title="">i</var> of a
@@ -66505,39 +66522,244 @@ <h5 id=the-datatransferitems-interface><span class=secno>8.7.3.1 </span>The <cod
items from the <a href=#drag-data-store>drag data store</a>. Otherwise, it must do
nothing.</p>
- </div>
+ <p>The <dfn id=dom-datatransferitems-add title=dom-DataTransferItems-add><code>add()</code></dfn> method
+ must run the following steps:</p>
+ <ol><li><p>If the <code><a href=#datatransferitems>DataTransferItems</a></code> object is not in the
+ <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i>, return null and
+ abort these steps.</li>
- <h5 id=the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code>DataTransferItem</code> interface</h5>
+ <li>
- <p class=XXX>...</p>
+ </ol></div>
-<!--
- DataTransferItem.kind = 'string', 'file', 'blob', 'data'?, ...
- .type = MIME type
- .getTextData(function callback (data)) - throws if kind is not 'string'
- .getRawData(function callback (data)) - throws if kind is not 'data'
- .getBlob() - returns File or Blob (which are async anyway); throws if kind is 'data'
+ <h5 id=the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code><a href=#datatransferitem>DataTransferItem</a></code> interface</h5>
- DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
- .onneeddata - can wait until this fires to provide data
- .setData() - call this once you have data, must be the right type
+ <p>Each <code><a href=#datatransferitem>DataTransferItem</a></code> object is associated with a
+ <code><a href=#datatransfer>DataTransfer</a></code> object.</p>
+
+ <pre class=idl>interface <dfn id=datatransferitem>DataTransferItem</dfn> {
+ readonly attribute DOMString <a href=#dom-datatransferitem-kind title=dom-DataTransferItem-kind>kind</a>;
+ readonly attribute DOMString <a href=#dom-datatransferitem-type title=dom-DataTransferItem-type>type</a>;
+ void <span title=dom-DataTransferItem-getAsText>getAsText</span>(in <a href=#functionstringcallback>FunctionStringCallback</a> callback);<!--
+DND-v3: <span>Blob</span> <span title="dom-DataTransferItem-getAsBlob">getAsBlob</span>();-->
+ <span>File</span> <a href=#dom-datatransferitem-getasfile title=dom-DataTransferItem-getAsFile>getAsFile</a>();<!--
+DND-v4: void <span title="dom-DataTransferItem-getAsObject">getAsObject</span>(in <span>FunctionObjectCallback</span> callback);-->
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id=functionstringcallback>FunctionStringCallback</dfn> {
+ void <span title=dom-FunctionStringCallback-handleEvent>handleEvent</span>(in DOMString data);
+};<!--
+
+// DND-v4:
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn>FunctionObjectCallback</dfn> {
+ void <span title="dom-FunctionObjectCallback-handleEvent">handleEvent</span>(in DOMString data);
+};--></pre>
+
+ <dl class=domintro><dt><var title="">item</var> . <code title=dom-DataTransferItem-kind><a href=#dom-datatransferitem-kind>kind</a></code></dt>
+ <dd>
+
+ <p>Returns the <span>drag data item kind</span>, one of: "string",
+ <!-- DND-v3: "blob", --> "file"<!-- DND-v4: , "object" -->.</p>
+
+ </dd>
+
+ <dt><var title="">item</var> . <code title=dom-DataTransferItem-type><a href=#dom-datatransferitem-type>type</a></code></dt>
+ <dd>
+
+ <p>Returns the <span>drag data item type string</span>.</p>
+
+ </dd>
+
+ <dt><var title="">item</var> . <code title=dom-DataTransferItem-getAsString><a href=#dom-datatransferitem-getasstring>getAsString</a></code>(<var title="">callback</var>)</dt>
+ <dd>
+
+ <p>Invokes the callback with the string data as the argument, if the <span>drag data item kind</span> is <i>Plain Unicode string</i>.</p>
+
+ </dd>
+
+<!-- DND-v3:
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsBlob">getAsBlob</code>()</dt>
+ <dd>
+
+ <p>Returns a <code>Blob</code> object, if the <span>drag data item kind</span> is <i>Blob</i> or <i>File</i>.</p>
+
+ </dd>
-->
-<!-- xxx mention that if an item is removed from a data store, DataTransferItem objects become unusable -->
+ <dt><var title="">file</var> = <var title="">item</var> . <code title=dom-DataTransferItem-getAsFile><a href=#dom-datatransferitem-getasfile>getAsFile</a></code>()</dt>
+ <dd>
+ <p>Returns a <code>File</code> object, if the <span>drag data item kind</span> is <i>File</i>.</p>
-<!--
+ </dd>
-XXX DND WIP
+<!-- DND-v4:
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
+ <dd>
-plan:
- 4. expose model with new API
- 5. add dropzone="..." feature
+ <p>Invokes the callback with the cloned object data as the argument, if the <span>drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>
+ </dd>
-->
+ </dl><div class=impl>
+
+ <p>While the <code><a href=#datatransferitem>DataTransferItem</a></code> object's
+ <code><a href=#datatransfer>DataTransfer</a></code> object is associated with a <a href=#drag-data-store>drag
+ data store</a> and that <a href=#drag-data-store>drag data store</a>'s <span>drag
+ drop store item list</span> still contains the item that the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object represents, the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object's <i>mode</i> is the same as
+ the <a href=#drag-data-store-mode>drag data store mode</a>. When the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
+ object is <em>not</em> associated with a <a href=#drag-data-store>drag data
+ store</a>, or if the item that the <code><a href=#datatransferitem>DataTransferItem</a></code>
+ object represents has been removed from the relevant <span>drag drop
+ store item list</span>, the <code><a href=#datatransferitem>DataTransferItem</a></code> object's
+ <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store>drag data
+ store</a> referenced in this section (which is used only when the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i>disabled
+ mode</i>) is the <a href=#drag-data-store>drag data store</a> with which the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
+ object is associated.</p>
+
+ <p>The <dfn id=dom-datatransferitem-kind title=dom-DataTransferItem-kind><code>kind</code></dfn> attribute
+ must return the empty string if the <code><a href=#datatransferitem>DataTransferItem</a></code>
+ object is in the <i>disabled mode</i>; otherwise it must return the
+ string given in the cell from the second column of the following
+ table from the row whose cell in the first column contains <a href=#the-drag-data-item-kind>the
+ drag data item kind</a> of the item represented by the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object:</p>
+
+ <table><thead><tr><th> Kind <th> String
+ <tbody><tr><td> <i>Plain Unicode string</i> <td> "<code title="">string</code>"
+<!-- DND-v3: <tr> <td> <i>Blob</i> <td> "<code title="">blob</code>"-->
+ <tr><td> <i>File</i> <td> "<code title="">file</code>"
+<!-- DND-v4: <tr> <td> <i>Object</i> <td> "<code title="">object</code>"-->
+ </table><p>The <dfn id=dom-datatransferitem-type title=dom-DataTransferItem-type><code>type</code></dfn> attribute
+ must return the empty string if the <code><a href=#datatransferitem>DataTransferItem</a></code>
+ object is in the <i>disabled mode</i>; otherwise it must return
+ <a href=#the-drag-data-item-type-string>the drag data item type string</a> of the item represented
+ by the <code><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
+
+ <p>The <dfn id=dom-datatransferitem-getasstring title=dom-DataTransferItem-getAsString><code>getAsString(<var title="">callback</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol><li><p>If the <var title="">callback</var> is null, abort these
+ steps.</li>
+
+ <li><p>If the <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i title=concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>, abort these steps. The
+ callback is never invoked.</li>
+
+ <li><p>If the <span>data drag item kind</span> is not <i>Plain
+ Unicode string</i>, abort these steps. The callback is never
+ invoked.</li>
+
+ <li><p>Otherwise, <a href=#queue-a-task>queue a task</a> to invoke <var title="">callback</var>, passing the actual data of the item
+ represented by the <code><a href=#datatransferitem>DataTransferItem</a></code> object as the
+ argument.</li>
+
+ </ol><!--DND-v3:
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsBlob"><code>getAsBlob()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li>
+
+--><!--DND-v4:
+ <p>If the <span>data drag item kind</span> is <i>Object</i>,
+ return null.</p></li>
+--><!--DND-v3:
+
+ <p>If the <span>data drag item kind</span> is <i>File</i>, then
+ return a new <code>File</code> object representing the actual data
+ of the item represented by the <code>DataTransferItem</code>
+ object.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Unicode Data
+ string</i>, then return a new <code>Blob</code> object
+ representing the actual data of the item represented by the
+ <code>DataTransferItem</code> object, with the <code
+ title="dom-Blob-type">type</code> of the <code>Blob</code> being
+ <span>the drag data item type string</span> and with the binary
+ data of the <code>Blob</code> object being the Unicode string
+ encoded as UTF-8. <a href="#refsRFC3629">[RFC3629]</a></p>
+
+ <p>Otherwise, the <span>data drag item kind</span> is <i>Blob</i>;
+ return a new <code>Blob</code> object representing the actual data
+ of the item represented by the <code>DataTransferItem</code>
+ object.</p>
+
+ </li>
+
+ </ol>
+--><p>The <dfn id=dom-datatransferitem-getasfile title=dom-DataTransferItem-getAsFile><code>getAsFile()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol><li><p>If the <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i title=concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>, return null and abort
+ these steps.</li>
+
+ <li><p>If the <span>data drag item kind</span> is not <i>File</i>,
+ then return null and abort these steps.</li>
+
+ <li><p>Return a new <code>File</code> object representing the
+ actual data of the item represented by the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
+
+ </ol><!--DND-v4:
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsObject"><code>getAsObject(<var
+ title="">callback</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li>
+
+ <p>Let <var title="">data</var> be the actual data of the item
+ represented by the <code>DataTransferItem</code> object.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Unicode Data
+ string</i>, then <var title="">data</var> is a <code
+ title="">DOMString</code> containing the actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Blob</i>, then
+ <var title="">data</var> is a <code>Blob</code> representing the
+ actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>File</i>, then
+ <var title="">data</var> is a <code>File</code> representing the
+ actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Object</i>, then
+ <var title="">data</var> is the object that is the actual
+ data.</p>
+
+ </li>
+
+ <li><span>Queue a task</span> to invoke <var
+ title="">callback</var>, passing a <span>structured clone</span> of
+ <var title="">data</var> as the argument.</p></li>
+
+ </ol>
+--></div>
+
<h4 id=the-dragevent-interface><span class=secno>8.7.4 </span>The <code><a href=#dragevent>DragEvent</a></code> interface</h4>
@@ -66791,7 +67013,7 @@ <h4 id=drag-and-drop-processing-model><span class=secno>8.7.5 </span>Drag-and-dr
</li>
- <!-- v2: text/html as an export format -->
+ <!-- DND-v2: text/html as an export format -->
<!--MD-->
@@ -66815,35 +67037,6 @@ <h4 id=drag-and-drop-processing-model><span class=secno>8.7.5 </span>Drag-and-dr
</dl></li>
-<!-- v2: deal with multiple vCards -->
-<!--
- <li>
-
- (if you put this back, don't forget to update this text as above)
-
- <p>The user agent must take the <span>list of dragged nodes</span>
- and <span title="extracting a vCard">extract the vCard data from
- those nodes</span>, and then must add the resulting string to the
- <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
- member, associated with the <code
- title="">text/directory;profile=vcard</code> format.</p>
-
- </li>
-
- <li>
-
- (if you put this back, don't forget to update this text as above)
-
- <p>The user agent must take the <span>list of dragged nodes</span>
- and <span title="extracting vEvent data">extract the vEvent data
- from those nodes</span>, and then must add the resulting string to
- the <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
- member, associated with the <code
- title="">text/calendar;component=vevent</code> format.</p>
-
- </li>
--->
-
<li>
<p>Run the following substeps:</p>
@@ -66865,7 +67058,7 @@ <h4 id=drag-and-drop-processing-model><span class=secno>8.7.5 </span>Drag-and-dr
<dd>Add to <var title="">urls</var> the result of <a href=#resolve-a-url title="resolve a url">resolving</a> the element's <code title=attr-img-src><a href=#attr-img-src>src</a></code> content attribute relative to
the element.</dd>
- <!-- v2: more -->
+ <!-- DND-v2: more -->
</dl></li>
@@ -67374,6 +67567,11 @@ <h4 id=dndevents><span class=secno>8.7.6 </span>Events summary</h4>
<h4 id=the-draggable-attribute><span class=secno>8.7.7 </span>The <dfn title=attr-draggable><code>draggable</code></dfn> attribute</h4>
+<!--
+XXX DND WIP plan:
+ 5. add dropzone="..." feature
+-->
+
<p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute set. The
<code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> attribute is an
<a href=#enumerated-attribute>enumerated attribute</a>. It has three states. The first
View
384 index
@@ -65729,7 +65729,7 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
<h3 id=dnd><span class=secno>8.7 </span><dfn>Drag and drop</dfn></h3>
-<!-- v2 ideas for drag and drop:
+<!-- v2: ideas for drag and drop:
* being able to animate a drop target:
@@ -65767,9 +65767,17 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
Ack: Ben Laurie (@g)
- * Promises. Should be able to say "if you accept this drop, then
- I can provide the File object that corresponds to it
- eventually".
+ Other things listed below:
+ DND-v2: more native support: text/html from selections, etc
+ DND-v3: add Blob support
+ DND-v4: add structured clone support
+ DND-v5: add promises (should be able to say "if you accept this
+ drop, then I can provide the File object that
+ corresponds to it eventually")
+
+ DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
+ .onneeddata - can wait until this fires to provide data
+ .setData() - call this once you have data, must be the right type
-->
@@ -65923,21 +65931,7 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
items representing the dragged data, each consisting of the
following information:</p>
- <dl><dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn></dt>
-
- <dd>
-
- <p>A Unicode string giving the type or format of the data,
- generally given by a <a href=#mime-type>MIME type</a>. Some values that
- are not <a href=#mime-type title="MIME type">MIME types</a> are
- special-cased for legacy reasons. The API does not enforce the
- use of <a href=#mime-type title="MIME type">MIME types</a>; other values
- can be used as well. In all cases, however, the values are all
- <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> by the API.</p>
-
- </dd>
-
- <dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn></dt>
+ <dl><dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn></dt>
<dd>
@@ -65948,17 +65942,19 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
<p>Text.</p>
</dd>
+<!-- DND-v3:
<dt><i>Blob</i></dt>
<dd>
<p>Binary data.</p>
</dd>
+-->
<dt><i>File</i></dt>
<dd>
<p>Binary data with a file name.</p>
</dd>
-<!-- v2:
+<!-- DND-v4:
<dt><i>Structured object</i></dt>
<dd>
<p>An object that will be cloned using the <span>structured clone</span> algorithm.</p>
@@ -65967,13 +65963,31 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
</dl></dd>
+ <dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn></dt>
+
+ <dd>
+
+ <p>A Unicode string giving the type or format of the data,
+ generally given by a <a href=#mime-type>MIME type</a>. Some values that
+ are not <a href=#mime-type title="MIME type">MIME types</a> are
+ special-cased for legacy reasons. The API does not enforce the
+ use of <a href=#mime-type title="MIME type">MIME types</a>; other values
+ can be used as well. In all cases, however, the values are all
+ <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a> by the API.</p>
+
+ </dd>
+
<dt>The actual data</dt>
<dd><p>A Unicode or binary string, optionally with a file name
- (itself a Unicode string), <!-- (v2:) or an object, --> as per
+ (itself a Unicode string), <!-- (DND-v4:) or an object, --> as per
<a href=#the-drag-data-item-kind>the drag data item kind</a>.</dd>
- </dl></li>
+ </dl><p>The <a href=#drag-data-store-item-list>drag data store item list</a> is ordered in the
+ order that the items were added to the list; most recently added
+ last.</p>
+
+ </li>
<li>
@@ -66331,10 +66345,10 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
<li><p>For each item in the <a href=#drag-data-store-item-list>drag data store item list</a>
<!-- in some order...? --> whose <a href=#the-drag-data-item-kind title="the drag data item
- kind">kind</a> is <i>File</i> (not <i>Blob</i>), add the item's
- data (the file, in particular its name and contents, as well as its
- <a href=#the-drag-data-item-type-string title="the drag data item type string">type</a>) to the
- list <var title="">L</var>.</li>
+ kind">kind</a> is <i>File</i> <!-- DND-v3: (not <i>Blob</i>) -->,
+ add the item's data (the file, in particular its name and contents,
+ as well as its <a href=#the-drag-data-item-type-string title="the drag data item type
+ string">type</a>) to the list <var title="">L</var>.</li>
<!-- <li><p>Sort the list...?</p></li> -->
@@ -66402,16 +66416,15 @@ interface <dfn id=navigatorabilities>NavigatorAbilities</dfn> {
<pre class=idl>interface <dfn id=datatransferitems>DataTransferItems</dfn> {
readonly attribute unsigned long <a href=#dom-datatransferitems-length title=dom-DataTransferItems-length>length</a>;
- <a href=#dom-datatransferitems-item title=dom-DataTransferItems-item>getter</a> <span>DataTransferItem</span> (in unsigned long index);
+ <a href=#dom-datatransferitems-item title=dom-DataTransferItems-item>getter</a> <a href=#datatransferitem>DataTransferItem</a> (in unsigned long index);
<a href=#dom-datatransferitems-removeitem title=dom-DataTransferItems-removeItem>deleter</a> void (in unsigned long index);
void <a href=#dom-datatransferitems-clear title=dom-DataTransferItems-clear>clear</a>();
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in DOMString data, in DOMString type);
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in <span>Blob</span> data);
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in <span>File</span> data);
- <span>DataTransferItem</span> <span title=dom-DataTransferItems-add>add</span>(in <span>DataTransferItem</span> data);<!--
-v2: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in any data, in DOMString type);--><!--
-v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferPromise</span> data);-->
+ <a href=#datatransferitem>DataTransferItem</a> <a href=#dom-datatransferitems-add title=dom-DataTransferItems-add>add</a>(in DOMString data, in DOMString type);<!--
+DND-v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>Blob</span> data);-->
+ <a href=#datatransferitem>DataTransferItem</a> <a href=#dom-datatransferitems-add title=dom-DataTransferItems-add>add</a>(in <span>File</span> data);<!--
+DND-v4: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in any data, in DOMString type);--><!--
+DND-v5: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferPromise</span> data);-->
};</pre>
<dl class=domintro><dt><var title="">items</var> . <code title=dom-DataTransferItems-length><a href=#dom-datatransferitems-length>length</a></code></dt>
@@ -66423,7 +66436,7 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
<dd>
- <p>Returns the <code>DataTransferItem</code> object representing the <var title="">index</var>th entry in the <a href=#drag-data-store>drag data store</a>.</p>
+ <p>Returns the <code><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var title="">index</var>th entry in the <a href=#drag-data-store>drag data store</a>.</p>
</dd>
@@ -66446,13 +66459,13 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
</dd>
- <dt><var title="">items</var> . <code title=dom-DataTransferItems-add>add</code>(<var title="">data</var>)</dt>
- <dt><var title="">items</var> . <code title=dom-DataTransferItems-add>add</code>(<var title="">data</var>, <var title="">type</var>)</dt>
+ <dt><var title="">items</var> . <code title=dom-DataTransferItems-add><a href=#dom-datatransferitems-add>add</a></code>(<var title="">data</var>)</dt>
+ <dt><var title="">items</var> . <code title=dom-DataTransferItems-add><a href=#dom-datatransferitems-add>add</a></code>(<var title="">data</var>, <var title="">type</var>)</dt>
<dd>
<p>Adds a new entry for the given data to the <a href=#drag-data-store>drag data
- store</a>. If the data is plain text <!-- v2: or an object -->
+ store</a>. If the data is plain text <!-- DND-v4: or an object -->
then a <var title="">type</var> string has to be provided
also.</p>
@@ -66467,12 +66480,12 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
When the <code><a href=#datatransferitems>DataTransferItems</a></code> object's
<code><a href=#datatransfer>DataTransfer</a></code> object is <em>not</em> associated with a
<a href=#drag-data-store>drag data store</a>, the <code><a href=#datatransferitems>DataTransferItems</a></code>
- object's <i>mode</i> is <i>disabled mode</i>. The <a href=#drag-data-store>drag data
- store</a> referenced in this section (which is used only when the
- <code><a href=#datatransferitems>DataTransferItems</a></code> object is not in the <i>disabled
- mode</i>) is the <a href=#drag-data-store>drag data store</a> with which the
- <code><a href=#datatransferitems>DataTransferItems</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
- object is associated.</p>
+ object's <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store>drag
+ data store</a> referenced in this section (which is used only
+ when the <code><a href=#datatransferitems>DataTransferItems</a></code> object is not in the
+ <i>disabled mode</i>) is the <a href=#drag-data-store>drag data store</a> with which
+ the <code><a href=#datatransferitems>DataTransferItems</a></code> object's
+ <code><a href=#datatransfer>DataTransfer</a></code> object is associated.</p>
<p>The <dfn id=dom-datatransferitems-length title=dom-DataTransferItems-length><code>length</code></dfn>
attribute must return zero if the object is in the <i>disabled
@@ -66491,7 +66504,11 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
<p>To <dfn id=dom-datatransferitems-item title=dom-DataTransferItems-item>determine the value of
an indexed property</dfn> <var title="">i</var> of a
<code><a href=#datatransferitems>DataTransferItems</a></code> object, the user agent must return a
- <code>DataTransferItem</code> object representing the <var title="">i</var>th item in the <a href=#drag-data-store>drag data store</a>.</p>
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var title="">i</var>th item in the <a href=#drag-data-store>drag data store</a>. The
+ same object must be returned each time. The
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object must be associated with the
+ same <code><a href=#datatransfer>DataTransfer</a></code> object as the
+ <code><a href=#datatransferitems>DataTransferItems</a></code> object when it is created.</p>
<p>To <dfn id=dom-datatransferitems-removeitem title=dom-DataTransferItems-removeItem>delete an
existing indexed property</dfn> <var title="">i</var> of a
@@ -66511,39 +66528,244 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
items from the <a href=#drag-data-store>drag data store</a>. Otherwise, it must do
nothing.</p>
- </div>
+ <p>The <dfn id=dom-datatransferitems-add title=dom-DataTransferItems-add><code>add()</code></dfn> method
+ must run the following steps:</p>
+ <ol><li><p>If the <code><a href=#datatransferitems>DataTransferItems</a></code> object is not in the
+ <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i>, return null and
+ abort these steps.</li>
- <h5 id=the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code>DataTransferItem</code> interface</h5>
+ <li>
- <p class=XXX>...</p>
+ </ol></div>
-<!--
- DataTransferItem.kind = 'string', 'file', 'blob', 'data'?, ...
- .type = MIME type
- .getTextData(function callback (data)) - throws if kind is not 'string'
- .getRawData(function callback (data)) - throws if kind is not 'data'
- .getBlob() - returns File or Blob (which are async anyway); throws if kind is 'data'
+ <h5 id=the-datatransferitem-interface><span class=secno>8.7.3.2 </span>The <code><a href=#datatransferitem>DataTransferItem</a></code> interface</h5>
- DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
- .onneeddata - can wait until this fires to provide data
- .setData() - call this once you have data, must be the right type
+ <p>Each <code><a href=#datatransferitem>DataTransferItem</a></code> object is associated with a
+ <code><a href=#datatransfer>DataTransfer</a></code> object.</p>
+
+ <pre class=idl>interface <dfn id=datatransferitem>DataTransferItem</dfn> {
+ readonly attribute DOMString <a href=#dom-datatransferitem-kind title=dom-DataTransferItem-kind>kind</a>;
+ readonly attribute DOMString <a href=#dom-datatransferitem-type title=dom-DataTransferItem-type>type</a>;
+ void <span title=dom-DataTransferItem-getAsText>getAsText</span>(in <a href=#functionstringcallback>FunctionStringCallback</a> callback);<!--
+DND-v3: <span>Blob</span> <span title="dom-DataTransferItem-getAsBlob">getAsBlob</span>();-->
+ <span>File</span> <a href=#dom-datatransferitem-getasfile title=dom-DataTransferItem-getAsFile>getAsFile</a>();<!--
+DND-v4: void <span title="dom-DataTransferItem-getAsObject">getAsObject</span>(in <span>FunctionObjectCallback</span> callback);-->
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id=functionstringcallback>FunctionStringCallback</dfn> {
+ void <span title=dom-FunctionStringCallback-handleEvent>handleEvent</span>(in DOMString data);
+};<!--
+
+// DND-v4:
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn>FunctionObjectCallback</dfn> {
+ void <span title="dom-FunctionObjectCallback-handleEvent">handleEvent</span>(in DOMString data);
+};--></pre>
+
+ <dl class=domintro><dt><var title="">item</var> . <code title=dom-DataTransferItem-kind><a href=#dom-datatransferitem-kind>kind</a></code></dt>
+ <dd>
+
+ <p>Returns the <span>drag data item kind</span>, one of: "string",
+ <!-- DND-v3: "blob", --> "file"<!-- DND-v4: , "object" -->.</p>
+
+ </dd>
+
+ <dt><var title="">item</var> . <code title=dom-DataTransferItem-type><a href=#dom-datatransferitem-type>type</a></code></dt>
+ <dd>
+
+ <p>Returns the <span>drag data item type string</span>.</p>
+
+ </dd>
+
+ <dt><var title="">item</var> . <code title=dom-DataTransferItem-getAsString><a href=#dom-datatransferitem-getasstring>getAsString</a></code>(<var title="">callback</var>)</dt>
+ <dd>
+
+ <p>Invokes the callback with the string data as the argument, if the <span>drag data item kind</span> is <i>Plain Unicode string</i>.</p>
+
+ </dd>
+
+<!-- DND-v3:
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsBlob">getAsBlob</code>()</dt>
+ <dd>
+
+ <p>Returns a <code>Blob</code> object, if the <span>drag data item kind</span> is <i>Blob</i> or <i>File</i>.</p>
+
+ </dd>
-->
-<!-- xxx mention that if an item is removed from a data store, DataTransferItem objects become unusable -->
+ <dt><var title="">file</var> = <var title="">item</var> . <code title=dom-DataTransferItem-getAsFile><a href=#dom-datatransferitem-getasfile>getAsFile</a></code>()</dt>
+ <dd>
+ <p>Returns a <code>File</code> object, if the <span>drag data item kind</span> is <i>File</i>.</p>
-<!--
+ </dd>
-XXX DND WIP
+<!-- DND-v4:
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
+ <dd>
-plan:
- 4. expose model with new API
- 5. add dropzone="..." feature
+ <p>Invokes the callback with the cloned object data as the argument, if the <span>drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>
+ </dd>
-->
+ </dl><div class=impl>
+
+ <p>While the <code><a href=#datatransferitem>DataTransferItem</a></code> object's
+ <code><a href=#datatransfer>DataTransfer</a></code> object is associated with a <a href=#drag-data-store>drag
+ data store</a> and that <a href=#drag-data-store>drag data store</a>'s <span>drag
+ drop store item list</span> still contains the item that the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object represents, the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object's <i>mode</i> is the same as
+ the <a href=#drag-data-store-mode>drag data store mode</a>. When the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
+ object is <em>not</em> associated with a <a href=#drag-data-store>drag data
+ store</a>, or if the item that the <code><a href=#datatransferitem>DataTransferItem</a></code>
+ object represents has been removed from the relevant <span>drag drop
+ store item list</span>, the <code><a href=#datatransferitem>DataTransferItem</a></code> object's
+ <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store>drag data
+ store</a> referenced in this section (which is used only when the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i>disabled
+ mode</i>) is the <a href=#drag-data-store>drag data store</a> with which the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object's <code><a href=#datatransfer>DataTransfer</a></code>
+ object is associated.</p>
+
+ <p>The <dfn id=dom-datatransferitem-kind title=dom-DataTransferItem-kind><code>kind</code></dfn> attribute
+ must return the empty string if the <code><a href=#datatransferitem>DataTransferItem</a></code>
+ object is in the <i>disabled mode</i>; otherwise it must return the
+ string given in the cell from the second column of the following
+ table from the row whose cell in the first column contains <a href=#the-drag-data-item-kind>the
+ drag data item kind</a> of the item represented by the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object:</p>
+
+ <table><thead><tr><th> Kind <th> String
+ <tbody><tr><td> <i>Plain Unicode string</i> <td> "<code title="">string</code>"
+<!-- DND-v3: <tr> <td> <i>Blob</i> <td> "<code title="">blob</code>"-->
+ <tr><td> <i>File</i> <td> "<code title="">file</code>"
+<!-- DND-v4: <tr> <td> <i>Object</i> <td> "<code title="">object</code>"-->
+ </table><p>The <dfn id=dom-datatransferitem-type title=dom-DataTransferItem-type><code>type</code></dfn> attribute
+ must return the empty string if the <code><a href=#datatransferitem>DataTransferItem</a></code>
+ object is in the <i>disabled mode</i>; otherwise it must return
+ <a href=#the-drag-data-item-type-string>the drag data item type string</a> of the item represented
+ by the <code><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
+
+ <p>The <dfn id=dom-datatransferitem-getasstring title=dom-DataTransferItem-getAsString><code>getAsString(<var title="">callback</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol><li><p>If the <var title="">callback</var> is null, abort these
+ steps.</li>
+
+ <li><p>If the <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i title=concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>, abort these steps. The
+ callback is never invoked.</li>
+
+ <li><p>If the <span>data drag item kind</span> is not <i>Plain
+ Unicode string</i>, abort these steps. The callback is never
+ invoked.</li>
+
+ <li><p>Otherwise, <a href=#queue-a-task>queue a task</a> to invoke <var title="">callback</var>, passing the actual data of the item
+ represented by the <code><a href=#datatransferitem>DataTransferItem</a></code> object as the
+ argument.</li>
+
+ </ol><!--DND-v3:
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsBlob"><code>getAsBlob()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li>
+
+--><!--DND-v4:
+ <p>If the <span>data drag item kind</span> is <i>Object</i>,
+ return null.</p></li>
+--><!--DND-v3:
+
+ <p>If the <span>data drag item kind</span> is <i>File</i>, then
+ return a new <code>File</code> object representing the actual data
+ of the item represented by the <code>DataTransferItem</code>
+ object.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Unicode Data
+ string</i>, then return a new <code>Blob</code> object
+ representing the actual data of the item represented by the
+ <code>DataTransferItem</code> object, with the <code
+ title="dom-Blob-type">type</code> of the <code>Blob</code> being
+ <span>the drag data item type string</span> and with the binary
+ data of the <code>Blob</code> object being the Unicode string
+ encoded as UTF-8. <a href="#refsRFC3629">[RFC3629]</a></p>
+
+ <p>Otherwise, the <span>data drag item kind</span> is <i>Blob</i>;
+ return a new <code>Blob</code> object representing the actual data
+ of the item represented by the <code>DataTransferItem</code>
+ object.</p>
+
+ </li>
+
+ </ol>
+--><p>The <dfn id=dom-datatransferitem-getasfile title=dom-DataTransferItem-getAsFile><code>getAsFile()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol><li><p>If the <code><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i title=concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i title=concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>, return null and abort
+ these steps.</li>
+
+ <li><p>If the <span>data drag item kind</span> is not <i>File</i>,
+ then return null and abort these steps.</li>
+
+ <li><p>Return a new <code>File</code> object representing the
+ actual data of the item represented by the
+ <code><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
+
+ </ol><!--DND-v4:
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsObject"><code>getAsObject(<var
+ title="">callback</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li>
+
+ <p>Let <var title="">data</var> be the actual data of the item
+ represented by the <code>DataTransferItem</code> object.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Unicode Data
+ string</i>, then <var title="">data</var> is a <code
+ title="">DOMString</code> containing the actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Blob</i>, then
+ <var title="">data</var> is a <code>Blob</code> representing the
+ actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>File</i>, then
+ <var title="">data</var> is a <code>File</code> representing the
+ actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Object</i>, then
+ <var title="">data</var> is the object that is the actual
+ data.</p>
+
+ </li>
+
+ <li><span>Queue a task</span> to invoke <var
+ title="">callback</var>, passing a <span>structured clone</span> of
+ <var title="">data</var> as the argument.</p></li>
+
+ </ol>
+--></div>
+
<h4 id=the-dragevent-interface><span class=secno>8.7.4 </span>The <code><a href=#dragevent>DragEvent</a></code> interface</h4>
@@ -66797,7 +67019,7 @@ plan:
</li>
- <!-- v2: text/html as an export format -->
+ <!-- DND-v2: text/html as an export format -->
<!--MD-->
@@ -66821,35 +67043,6 @@ plan:
</dl></li>
-<!-- v2: deal with multiple vCards -->
-<!--
- <li>
-
- (if you put this back, don't forget to update this text as above)
-
- <p>The user agent must take the <span>list of dragged nodes</span>
- and <span title="extracting a vCard">extract the vCard data from
- those nodes</span>, and then must add the resulting string to the
- <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
- member, associated with the <code
- title="">text/directory;profile=vcard</code> format.</p>
-
- </li>
-
- <li>
-
- (if you put this back, don't forget to update this text as above)
-
- <p>The user agent must take the <span>list of dragged nodes</span>
- and <span title="extracting vEvent data">extract the vEvent data
- from those nodes</span>, and then must add the resulting string to
- the <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
- member, associated with the <code
- title="">text/calendar;component=vevent</code> format.</p>
-
- </li>
--->
-
<li>
<p>Run the following substeps:</p>
@@ -66871,7 +67064,7 @@ plan:
<dd>Add to <var title="">urls</var> the result of <a href=#resolve-a-url title="resolve a url">resolving</a> the element's <code title=attr-img-src><a href=#attr-img-src>src</a></code> content attribute relative to
the element.</dd>
- <!-- v2: more -->
+ <!-- DND-v2: more -->
</dl></li>
@@ -67380,6 +67573,11 @@ plan:
<h4 id=the-draggable-attribute><span class=secno>8.7.7 </span>The <dfn title=attr-draggable><code>draggable</code></dfn> attribute</h4>
+<!--
+XXX DND WIP plan:
+ 5. add dropzone="..." feature
+-->
+
<p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> content attribute set. The
<code title=attr-draggable><a href=#the-draggable-attribute>draggable</a></code> attribute is an
<a href=#enumerated-attribute>enumerated attribute</a>. It has three states. The first
View
404 source
@@ -74883,7 +74883,7 @@ interface <dfn>NavigatorAbilities</dfn> {
<h3 id="dnd"><dfn>Drag and drop</dfn></h3>
-<!-- v2 ideas for drag and drop:
+<!-- v2: ideas for drag and drop:
* being able to animate a drop target:
@@ -74921,9 +74921,17 @@ interface <dfn>NavigatorAbilities</dfn> {
Ack: Ben Laurie (@g)
- * Promises. Should be able to say "if you accept this drop, then
- I can provide the File object that corresponds to it
- eventually".
+ Other things listed below:
+ DND-v2: more native support: text/html from selections, etc
+ DND-v3: add Blob support
+ DND-v4: add structured clone support
+ DND-v5: add promises (should be able to say "if you accept this
+ drop, then I can provide the File object that
+ corresponds to it eventually")
+
+ DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
+ .onneeddata - can wait until this fires to provide data
+ .setData() - call this once you have data, must be the right type
-->
@@ -75089,20 +75097,6 @@ interface <dfn>NavigatorAbilities</dfn> {
<dl>
- <dt><dfn>The drag data item type string</dfn></dt>
-
- <dd>
-
- <p>A Unicode string giving the type or format of the data,
- generally given by a <span>MIME type</span>. Some values that
- are not <span title="MIME type">MIME types</span> are
- special-cased for legacy reasons. The API does not enforce the
- use of <span title="MIME type">MIME types</span>; other values
- can be used as well. In all cases, however, the values are all
- <span>converted to ASCII lowercase</span> by the API.</p>
-
- </dd>
-
<dt><dfn>The drag data item kind</dfn></dt>
<dd>
@@ -75116,17 +75110,19 @@ interface <dfn>NavigatorAbilities</dfn> {
<p>Text.</p>
</dd>
+<!-- DND-v3:
<dt><i>Blob</i></dt>
<dd>
<p>Binary data.</p>
</dd>
+-->
<dt><i>File</i></dt>
<dd>
<p>Binary data with a file name.</p>
</dd>
-<!-- v2:
+<!-- DND-v4:
<dt><i>Structured object</i></dt>
<dd>
<p>An object that will be cloned using the <span>structured clone</span> algorithm.</p>
@@ -75137,14 +75133,32 @@ interface <dfn>NavigatorAbilities</dfn> {
</dd>
+ <dt><dfn>The drag data item type string</dfn></dt>
+
+ <dd>
+
+ <p>A Unicode string giving the type or format of the data,
+ generally given by a <span>MIME type</span>. Some values that
+ are not <span title="MIME type">MIME types</span> are
+ special-cased for legacy reasons. The API does not enforce the
+ use of <span title="MIME type">MIME types</span>; other values
+ can be used as well. In all cases, however, the values are all
+ <span>converted to ASCII lowercase</span> by the API.</p>
+
+ </dd>
+
<dt>The actual data</dt>
<dd><p>A Unicode or binary string, optionally with a file name
- (itself a Unicode string), <!-- (v2:) or an object, --> as per
+ (itself a Unicode string), <!-- (DND-v4:) or an object, --> as per
<span>the drag data item kind</span>.</p></dd>
</dl>
+ <p>The <span>drag data store item list</span> is ordered in the
+ order that the items were added to the list; most recently added
+ last.</p>
+
</li>
<li>
@@ -75587,10 +75601,10 @@ interface <dfn>NavigatorAbilities</dfn> {
<li><p>For each item in the <span>drag data store item list</span>
<!-- in some order...? --> whose <span title="the drag data item
- kind">kind</span> is <i>File</i> (not <i>Blob</i>), add the item's
- data (the file, in particular its name and contents, as well as its
- <span title="the drag data item type string">type</span>) to the
- list <var title="">L</var>.</p></li>
+ kind">kind</span> is <i>File</i> <!-- DND-v3: (not <i>Blob</i>) -->,
+ add the item's data (the file, in particular its name and contents,
+ as well as its <span title="the drag data item type
+ string">type</span>) to the list <var title="">L</var>.</p></li>
<!-- <li><p>Sort the list...?</p></li> -->
@@ -75682,12 +75696,11 @@ interface <dfn>NavigatorAbilities</dfn> {
<span title="dom-DataTransferItems-removeItem">deleter</span> void (in unsigned long index);
void <span title="dom-DataTransferItems-clear">clear</span>();
- <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in DOMString data, in DOMString type);
- <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>Blob</span> data);
- <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>File</span> data);
- <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferItem</span> data);<!--
-v2: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in any data, in DOMString type);--><!--
-v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferPromise</span> data);-->
+ <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in DOMString data, in DOMString type);<!--
+DND-v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>Blob</span> data);-->
+ <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>File</span> data);<!--
+DND-v4: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in any data, in DOMString type);--><!--
+DND-v5: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</span>(in <span>DataTransferPromise</span> data);-->
};</pre>
<dl class="domintro">
@@ -75730,7 +75743,7 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
<dd>
<p>Adds a new entry for the given data to the <span>drag data
- store</span>. If the data is plain text <!-- v2: or an object -->
+ store</span>. If the data is plain text <!-- DND-v4: or an object -->
then a <var title="">type</var> string has to be provided
also.</p>
@@ -75747,12 +75760,12 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
When the <code>DataTransferItems</code> object's
<code>DataTransfer</code> object is <em>not</em> associated with a
<span>drag data store</span>, the <code>DataTransferItems</code>
- object's <i>mode</i> is <i>disabled mode</i>. The <span>drag data
- store</span> referenced in this section (which is used only when the
- <code>DataTransferItems</code> object is not in the <i>disabled
- mode</i>) is the <span>drag data store</span> with which the
- <code>DataTransferItems</code> object's <code>DataTransfer</code>
- object is associated.</p>
+ object's <i>mode</i> is the <i>disabled mode</i>. The <span>drag
+ data store</span> referenced in this section (which is used only
+ when the <code>DataTransferItems</code> object is not in the
+ <i>disabled mode</i>) is the <span>drag data store</span> with which
+ the <code>DataTransferItems</code> object's
+ <code>DataTransfer</code> object is associated.</p>
<p>The <dfn
title="dom-DataTransferItems-length"><code>length</code></dfn>
@@ -75773,7 +75786,11 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
an indexed property</dfn> <var title="">i</var> of a
<code>DataTransferItems</code> object, the user agent must return a
<code>DataTransferItem</code> object representing the <var
- title="">i</var>th item in the <span>drag data store</span>.</p>
+ title="">i</var>th item in the <span>drag data store</span>. The
+ same object must be returned each time. The
+ <code>DataTransferItem</code> object must be associated with the
+ same <code>DataTransfer</code> object as the
+ <code>DataTransferItems</code> object when it is created.</p>
<p>To <dfn title="dom-DataTransferItems-removeItem">delete an
existing indexed property</dfn> <var title="">i</var> of a
@@ -75799,39 +75816,280 @@ v3: <span>DataTransferItem</span> <span title="dom-DataTransferItems-add">add</
items from the <span>drag data store</span>. Otherwise, it must do
nothing.</p>
+ <p>The <dfn
+ title="dom-DataTransferItems-add"><code>add()</code></dfn> method
+ must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItems</code> object is not in the
+ <i title="concept-dnd-rw">read/write mode</i>, return null and
+ abort these steps.</p></li>
+
+ <li>
+
+ </ol>
+
</div>
<h5>The <code>DataTransferItem</code> interface</h5>
- <p class="XXX">...</p>
+ <p>Each <code>DataTransferItem</code> object is associated with a
+ <code>DataTransfer</code> object.</p>
-<!--
+ <pre class="idl">interface <dfn>DataTransferItem</dfn> {
+ readonly attribute DOMString <span title="dom-DataTransferItem-kind">kind</span>;
+ readonly attribute DOMString <span title="dom-DataTransferItem-type">type</span>;
+ void <span title="dom-DataTransferItem-getAsText">getAsText</span>(in <span>FunctionStringCallback</span> callback);<!--
+DND-v3: <span>Blob</span> <span title="dom-DataTransferItem-getAsBlob">getAsBlob</span>();-->
+ <span>File</span> <span title="dom-DataTransferItem-getAsFile">getAsFile</span>();<!--
+DND-v4: void <span title="dom-DataTransferItem-getAsObject">getAsObject</span>(in <span>FunctionObjectCallback</span> callback);-->
+};
- DataTransferItem.kind = 'string', 'file', 'blob', 'data'?, ...
- .type = MIME type
- .getTextData(function callback (data)) - throws if kind is not 'string'
- .getRawData(function callback (data)) - throws if kind is not 'data'
- .getBlob() - returns File or Blob (which are async anyway); throws if kind is 'data'
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn>FunctionStringCallback</dfn> {
+ void <span title="dom-FunctionStringCallback-handleEvent">handleEvent</span>(in DOMString data);
+};<!--
- DataTransferPromise.type = 'string' or 'file' or 'blob' or 'data'
- .onneeddata - can wait until this fires to provide data
- .setData() - call this once you have data, must be the right type
+// DND-v4:
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn>FunctionObjectCallback</dfn> {
+ void <span title="dom-FunctionObjectCallback-handleEvent">handleEvent</span>(in DOMString data);
+};--></pre>
+
+ <dl class="domintro">
+
+ <dt><var title="">item</var> . <code title="dom-DataTransferItem-kind">kind</code></dt>
+ <dd>
+
+ <p>Returns the <span>drag data item kind</span>, one of: "string",
+ <!-- DND-v3: "blob", --> "file"<!-- DND-v4: , "object" -->.</p>
+
+ </dd>
+
+ <dt><var title="">item</var> . <code title="dom-DataTransferItem-type">type</code></dt>
+ <dd>
+
+ <p>Returns the <span>drag data item type string</span>.</p>
+
+ </dd>
+
+ <dt><var title="">item</var> . <code title="dom-DataTransferItem-getAsString">getAsString</code>(<var title="">callback</var>)</dt>
+ <dd>
+
+ <p>Invokes the callback with the string data as the argument, if the <span>drag data item kind</span> is <i>Plain Unicode string</i>.</p>
+
+ </dd>
+
+<!-- DND-v3:
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsBlob">getAsBlob</code>()</dt>
+ <dd>
+
+ <p>Returns a <code>Blob</code> object, if the <span>drag data item kind</span> is <i>Blob</i> or <i>File</i>.</p>
+
+ </dd>
-->
-<!-- xxx mention that if an item is removed from a data store, DataTransferItem objects become unusable -->
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
+ <dd>
+ <p>Returns a <code>File</code> object, if the <span>drag data item kind</span> is <i>File</i>.</p>
-<!--
+ </dd>
-XXX DND WIP
+<!-- DND-v4:
+ <dt><var title="">file</var> = <var title="">item</var> . <code title="dom-DataTransferItem-getAsFile">getAsFile</code>()</dt>
+ <dd>
-plan:
- 4. expose model with new API
- 5. add dropzone="..." feature
+ <p>Invokes the callback with the cloned object data as the argument, if the <span>drag data item kind</span> is <i>Plain Unicode string</i> or <i>Object</i>.</p>
+ </dd>
-->
+ </dl>
+
+ <div class="impl">
+
+ <p>While the <code>DataTransferItem</code> object's
+ <code>DataTransfer</code> object is associated with a <span>drag
+ data store</span> and that <span>drag data store</span>'s <span>drag
+ drop store item list</span> still contains the item that the
+ <code>DataTransferItem</code> object represents, the
+ <code>DataTransferItem</code> object's <i>mode</i> is the same as
+ the <span>drag data store mode</span>. When the
+ <code>DataTransferItem</code> object's <code>DataTransfer</code>
+ object is <em>not</em> associated with a <span>drag data
+ store</span>, or if the item that the <code>DataTransferItem</code>
+ object represents has been removed from the relevant <span>drag drop
+ store item list</span>, the <code>DataTransferItem</code> object's
+ <i>mode</i> is the <i>disabled mode</i>. The <span>drag data
+ store</span> referenced in this section (which is used only when the
+ <code>DataTransferItem</code> object is not in the <i>disabled
+ mode</i>) is the <span>drag data store</span> with which the
+ <code>DataTransferItem</code> object's <code>DataTransfer</code>
+ object is associated.</p>
+
+ <p>The <dfn
+ title="dom-DataTransferItem-kind"><code>kind</code></dfn> attribute
+ must return the empty string if the <code>DataTransferItem</code>
+ object is in the <i>disabled mode</i>; otherwise it must return the
+ string given in the cell from the second column of the following
+ table from the row whose cell in the first column contains <span>the
+ drag data item kind</span> of the item represented by the
+ <code>DataTransferItem</code> object:</p>
+
+ <table>
+ <thead>
+ <tr> <th> Kind <th> String
+ <tbody>
+ <tr> <td> <i>Plain Unicode string</i> <td> "<code title="">string</code>"
+<!-- DND-v3: <tr> <td> <i>Blob</i> <td> "<code title="">blob</code>"-->
+ <tr> <td> <i>File</i> <td> "<code title="">file</code>"
+<!-- DND-v4: <tr> <td> <i>Object</i> <td> "<code title="">object</code>"-->
+ </table>
+
+ <p>The <dfn
+ title="dom-DataTransferItem-type"><code>type</code></dfn> attribute
+ must return the empty string if the <code>DataTransferItem</code>
+ object is in the <i>disabled mode</i>; otherwise it must return
+ <span>the drag data item type string</span> of the item represented
+ by the <code>DataTransferItem</code> object.</p>
+
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsString"><code>getAsString(<var
+ title="">callback</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li><p>If the <var title="">callback</var> is null, abort these
+ steps.</p></li>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, abort these steps. The
+ callback is never invoked.</p></li>
+
+ <li><p>If the <span>data drag item kind</span> is not <i>Plain
+ Unicode string</i>, abort these steps. The callback is never
+ invoked.</p></li>
+
+ <li><p>Otherwise, <span>queue a task</span> to invoke <var
+ title="">callback</var>, passing the actual data of the item
+ represented by the <code>DataTransferItem</code> object as the
+ argument.</p></li>
+
+ </ol>
+
+<!--DND-v3:
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsBlob"><code>getAsBlob()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li>
+
+--><!--DND-v4:
+ <p>If the <span>data drag item kind</span> is <i>Object</i>,
+ return null.</p></li>
+--><!--DND-v3:
+
+ <p>If the <span>data drag item kind</span> is <i>File</i>, then
+ return a new <code>File</code> object representing the actual data
+ of the item represented by the <code>DataTransferItem</code>
+ object.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Unicode Data
+ string</i>, then return a new <code>Blob</code> object
+ representing the actual data of the item represented by the
+ <code>DataTransferItem</code> object, with the <code
+ title="dom-Blob-type">type</code> of the <code>Blob</code> being
+ <span>the drag data item type string</span> and with the binary
+ data of the <code>Blob</code> object being the Unicode string
+ encoded as UTF-8. <a href="#refsRFC3629">[RFC3629]</a></p>
+
+ <p>Otherwise, the <span>data drag item kind</span> is <i>Blob</i>;
+ return a new <code>Blob</code> object representing the actual data
+ of the item represented by the <code>DataTransferItem</code>
+ object.</p>
+
+ </li>
+
+ </ol>
+-->
+
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsFile"><code>getAsFile()</code></dfn>
+ method must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li><p>If the <span>data drag item kind</span> is not <i>File</i>,
+ then return null and abort these steps.</p></li>
+
+ <li><p>Return a new <code>File</code> object representing the
+ actual data of the item represented by the
+ <code>DataTransferItem</code> object.</p>
+
+ </ol>
+
+<!--DND-v4:
+ <p>The <dfn
+ title="dom-DataTransferItem-getAsObject"><code>getAsObject(<var
+ title="">callback</var>)</code></dfn> method must run the following
+ steps:</p>
+
+ <ol>
+
+ <li><p>If the <code>DataTransferItem</code> object is not in the <i
+ title="concept-dnd-rw">read/write mode</i> or the <i
+ title="concept-dnd-ro">read-only mode</i>, return null and abort
+ these steps.</p></li>
+
+ <li>
+
+ <p>Let <var title="">data</var> be the actual data of the item
+ represented by the <code>DataTransferItem</code> object.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Unicode Data
+ string</i>, then <var title="">data</var> is a <code
+ title="">DOMString</code> containing the actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Blob</i>, then
+ <var title="">data</var> is a <code>Blob</code> representing the
+ actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>File</i>, then
+ <var title="">data</var> is a <code>File</code> representing the
+ actual data.</p>
+
+ <p>If the <span>data drag item kind</span> is <i>Object</i>, then
+ <var title="">data</var> is the object that is the actual
+ data.</p>
+
+ </li>
+
+ <li><span>Queue a task</span> to invoke <var
+ title="">callback</var>, passing a <span>structured clone</span> of
+ <var title="">data</var> as the argument.</p></li>
+
+ </ol>
+-->
+
+ </div>
+
<h4>The <code>DragEvent</code> interface</h4>
@@ -76147,7 +76405,7 @@ plan:
</li>
- <!-- v2: text/html as an export format -->
+ <!-- DND-v2: text/html as an export format -->
<!--END w3c-html--><!--MD-->
@@ -76182,35 +76440,6 @@ plan:
<!--START complete--><!--START epub--><!--START html-->
-<!-- v2: deal with multiple vCards -->
-<!--
- <li>
-
- (if you put this back, don't forget to update this text as above)
-
- <p>The user agent must take the <span>list of dragged nodes</span>
- and <span title="extracting a vCard">extract the vCard data from
- those nodes</span>, and then must add the resulting string to the
- <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
- member, associated with the <code
- title="">text/directory;profile=vcard</code> format.</p>
-
- </li>
-
- <li>
-
- (if you put this back, don't forget to update this text as above)
-
- <p>The user agent must take the <span>list of dragged nodes</span>
- and <span title="extracting vEvent data">extract the vEvent data
- from those nodes</span>, and then must add the resulting string to
- the <code title="dom-DragEvent-dataTransfer">dataTransfer</code>
- member, associated with the <code
- title="">text/calendar;component=vevent</code> format.</p>
-
- </li>
--->
-
<li>
<p>Run the following substeps:</p>
@@ -76243,7 +76472,7 @@ plan:
title="attr-img-src">src</code> content attribute relative to
the element.</dd>
- <!-- v2: more -->
+ <!-- DND-v2: more -->
</dl>
@@ -76894,6 +77123,11 @@ plan:
<h4>The <dfn title="attr-draggable"><code>draggable</code></dfn> attribute</h4>
+<!--
+XXX DND WIP plan:
+ 5. add dropzone="..." feature
+-->
+
<p>All <span>HTML elements</span> may have the <code
title="attr-draggable">draggable</code> content attribute set. The
<code title="attr-draggable">draggable</code> attribute is an

0 comments on commit bf0d748

Please sign in to comment.