Navigation Menu

Skip to content

Commit

Permalink
[giow] (2) Make the drag-and-drop API lowercase all the format strings.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@4645 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 4, 2010
1 parent f581ea2 commit b98e78b
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 84 deletions.
74 changes: 48 additions & 26 deletions complete.html
Expand Up @@ -61618,6 +61618,20 @@ <h3 id=dnd><span class=secno>8.9 </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".

* Exposing more information about each item. Best idea (from
Eduard Pascual) is to have a new attribute on dataTransfer
that's a list of items, each of which has:

.kind = text data, File data, promise
.type = a MIME type
.getData(callback) = calls the callback once the data is available
.setData(value) = replace the value
.remove() = removes the entry

-->

<p>This section defines an event-based drag-and-drop mechanism.</p>
Expand Down Expand Up @@ -61811,9 +61825,10 @@ <h4 id=the-dragevent-and-datatransfer-interfaces><span class=secno>8.9.2 </span>
<p><code><a href=#datatransfer>DataTransfer</a></code> objects can hold pieces of data, each
associated with a unique format. Formats are generally given by
<a href=#mime-type title="MIME type">MIME types</a>, with some values
special-cased for legacy reasons. For the purposes of this API,
however, the format strings are opaque, <a href=#case-sensitive>case-sensitive</a>,
strings, and the empty string is a valid format string.</p>
special-cased for legacy reasons. However, the API does not enforce
this; non-MIME-type values can be added as well. All formats are
identified by strings that are <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a> by the API.</p>

<dl class=domintro><dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> [ = <var title="">value</var> ]</dt>

Expand Down Expand Up @@ -61937,14 +61952,10 @@ <h4 id=the-dragevent-and-datatransfer-interfaces><span class=secno>8.9.2 </span>
<p>The <dfn id=dom-datatransfer-types title=dom-DataTransfer-types><code>types</code></dfn>
attribute must return a live <code>DOMStringList</code> that
contains the list of formats that were added to the
<code><a href=#datatransfer>DataTransfer</a></code> object in the corresponding <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event. If any files were
<code><a href=#datatransfer>DataTransfer</a></code> object in the corresponding <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event. If any files were
included in the drag, then the <code>DOMStringList</code> object
must in addition include the string "<code title="">Files</code>".</p>

<p class=note>If the <code title=dom-DataTransfer-setData><a href=#dom-datatransfer-setdata>setData()</a></code> method is invoked
with the string "<code title="">Files</code>", and some files were
included in the drag, then the string "<code title="">Files</code>"
will appear twice in the <code title=dom-DataTransfer-types><a href=#dom-datatransfer-types>types</a></code> attribute's list.</p>
must in addition include the string "<code title="">Files</code>". (This value can be distinguished from the
other values because it is not lowercase.)</p>

<p>The <dfn id=dom-datatransfer-cleardata title=dom-DataTransfer-clearData><code>clearData()</code></dfn>
method, when called with no arguments, must clear the
Expand All @@ -61958,35 +61969,42 @@ <h4 id=the-dragevent-and-datatransfer-interfaces><span class=secno>8.9.2 </span>

<p>When called with an argument, the <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData(<var title="">format</var>)</a></code> method must clear the
<code><a href=#datatransfer>DataTransfer</a></code> object of any data associated with the
given <var title="">format</var>. If <var title="">format</var> is
the value "<code title="">Text</code>", then it must be treated as
"<code title="">text/plain</code>". If the <var title="">format</var> is "<code title="">URL</code>", then it must
be treated as "<code title="">text/uri-list</code>".</p>
given <var title="">format</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a>. If <var title="">format</var> (after conversion to
lowercase) is the value "<code title="">text</code>", then it must
be treated as "<code title="">text/plain</code>". If the <var title="">format</var> (after conversion to lowercase) is "<code title="">url</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>

<p>The <dfn id=dom-datatransfer-setdata title=dom-DataTransfer-setData><code>setData(<var title="">format</var>, <var title="">data</var>)</code></dfn> method
must add <var title="">data</var> to the data stored in the
<code><a href=#datatransfer>DataTransfer</a></code> object, labeled as being of the type <var title="">format</var>. This must replace any previous data that had
been set for that format. If <var title="">format</var> is the value
"<code title="">Text</code>", then it must be treated as "<code title="">text/plain</code>". If the <var title="">format</var> is
"<code title="">URL</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>
<code><a href=#datatransfer>DataTransfer</a></code> object, labeled as being of the type <var title="">format</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a>. This must replace any previous data that had been
set for that format. If <var title="">format</var> (after conversion
to lowercase) is the value "<code title="">text</code>", then it
must be treated as "<code title="">text/plain</code>". If the <var title="">format</var> (after conversion to lowercase) is "<code title="">url</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>

<p>The <dfn id=dom-datatransfer-getdata title=dom-DataTransfer-getData><code>getData(<var title="">format</var>)</code></dfn> method must return the data that
is associated with the type <var title="">format</var>, if any, and
must return the empty string otherwise. If <var title="">format</var> is the value "<code title="">Text</code>",
is associated with the type <var title="">format</var>
<a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, if any, and must return
the empty string otherwise. If <var title="">format</var> (after
conversion to lowercase) is the value "<code title="">text</code>",
then it must be treated as "<code title="">text/plain</code>". If
the <var title="">format</var> is "<code title="">URL</code>", then
the data associated with the "<code title="">text/uri-list</code>"
format must be parsed as appropriate for <code title="">text/uri-list</code> data, and the first URL from the list
must be returned. If there is no data with that format, or if there
is but it has no URLs, then the method must return the empty
string. <a href=#refsRFC2483>[RFC2483]</a></p>
the <var title="">format</var> (after conversion to lowercase) is
"<code title="">url</code>", then the data associated with the
"<code title="">text/uri-list</code>" format must be parsed as
appropriate for <code title="">text/uri-list</code> data, and the
first URL from the list must be returned. If there is no data with
that format, or if there is but it has no URLs, then the method must
return the empty string. <a href=#refsRFC2483>[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 class=note>This version of the API does not expose the types of
the files during the drag.</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
Expand Down Expand Up @@ -62689,6 +62707,10 @@ <h5 id=when-the-drag-and-drop-operation-starts-or-ends-in-another-application><s
user agents must similarly use platform-specific conventions when
deciding on what drag feedback to use.</p>

<p>All the format strings must be <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a>. If the platform conventions do not use <a href=#mime-type title="MIME type">MIME types</a> to label the dragged data, the
user agent must map the types to MIME types first.</p>

<p>If a drag is started in a document but ends in another
application, then the user agent must instead replace the parts of
the processing model relating to handling the <em>target</em>
Expand Down
74 changes: 48 additions & 26 deletions index
Expand Up @@ -60821,6 +60821,20 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU

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".

* Exposing more information about each item. Best idea (from
Eduard Pascual) is to have a new attribute on dataTransfer
that's a list of items, each of which has:

.kind = text data, File data, promise
.type = a MIME type
.getData(callback) = calls the callback once the data is available
.setData(value) = replace the value
.remove() = removes the entry

-->

<p>This section defines an event-based drag-and-drop mechanism.</p>
Expand Down Expand Up @@ -61014,9 +61028,10 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
<p><code><a href=#datatransfer>DataTransfer</a></code> objects can hold pieces of data, each
associated with a unique format. Formats are generally given by
<a href=#mime-type title="MIME type">MIME types</a>, with some values
special-cased for legacy reasons. For the purposes of this API,
however, the format strings are opaque, <a href=#case-sensitive>case-sensitive</a>,
strings, and the empty string is a valid format string.</p>
special-cased for legacy reasons. However, the API does not enforce
this; non-MIME-type values can be added as well. All formats are
identified by strings that are <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a> by the API.</p>

<dl class=domintro><dt><var title="">dataTransfer</var> . <code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> [ = <var title="">value</var> ]</dt>

Expand Down Expand Up @@ -61140,14 +61155,10 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
<p>The <dfn id=dom-datatransfer-types title=dom-DataTransfer-types><code>types</code></dfn>
attribute must return a live <code>DOMStringList</code> that
contains the list of formats that were added to the
<code><a href=#datatransfer>DataTransfer</a></code> object in the corresponding <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event. If any files were
<code><a href=#datatransfer>DataTransfer</a></code> object in the corresponding <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event. If any files were
included in the drag, then the <code>DOMStringList</code> object
must in addition include the string "<code title="">Files</code>".</p>

<p class=note>If the <code title=dom-DataTransfer-setData><a href=#dom-datatransfer-setdata>setData()</a></code> method is invoked
with the string "<code title="">Files</code>", and some files were
included in the drag, then the string "<code title="">Files</code>"
will appear twice in the <code title=dom-DataTransfer-types><a href=#dom-datatransfer-types>types</a></code> attribute's list.</p>
must in addition include the string "<code title="">Files</code>". (This value can be distinguished from the
other values because it is not lowercase.)</p>

<p>The <dfn id=dom-datatransfer-cleardata title=dom-DataTransfer-clearData><code>clearData()</code></dfn>
method, when called with no arguments, must clear the
Expand All @@ -61161,35 +61172,42 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU

<p>When called with an argument, the <code title=dom-DataTransfer-clearData><a href=#dom-datatransfer-cleardata>clearData(<var title="">format</var>)</a></code> method must clear the
<code><a href=#datatransfer>DataTransfer</a></code> object of any data associated with the
given <var title="">format</var>. If <var title="">format</var> is
the value "<code title="">Text</code>", then it must be treated as
"<code title="">text/plain</code>". If the <var title="">format</var> is "<code title="">URL</code>", then it must
be treated as "<code title="">text/uri-list</code>".</p>
given <var title="">format</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a>. If <var title="">format</var> (after conversion to
lowercase) is the value "<code title="">text</code>", then it must
be treated as "<code title="">text/plain</code>". If the <var title="">format</var> (after conversion to lowercase) is "<code title="">url</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>

<p>The <dfn id=dom-datatransfer-setdata title=dom-DataTransfer-setData><code>setData(<var title="">format</var>, <var title="">data</var>)</code></dfn> method
must add <var title="">data</var> to the data stored in the
<code><a href=#datatransfer>DataTransfer</a></code> object, labeled as being of the type <var title="">format</var>. This must replace any previous data that had
been set for that format. If <var title="">format</var> is the value
"<code title="">Text</code>", then it must be treated as "<code title="">text/plain</code>". If the <var title="">format</var> is
"<code title="">URL</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>
<code><a href=#datatransfer>DataTransfer</a></code> object, labeled as being of the type <var title="">format</var>, <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a>. This must replace any previous data that had been
set for that format. If <var title="">format</var> (after conversion
to lowercase) is the value "<code title="">text</code>", then it
must be treated as "<code title="">text/plain</code>". If the <var title="">format</var> (after conversion to lowercase) is "<code title="">url</code>", then it must be treated as "<code title="">text/uri-list</code>".</p>

<p>The <dfn id=dom-datatransfer-getdata title=dom-DataTransfer-getData><code>getData(<var title="">format</var>)</code></dfn> method must return the data that
is associated with the type <var title="">format</var>, if any, and
must return the empty string otherwise. If <var title="">format</var> is the value "<code title="">Text</code>",
is associated with the type <var title="">format</var>
<a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, if any, and must return
the empty string otherwise. If <var title="">format</var> (after
conversion to lowercase) is the value "<code title="">text</code>",
then it must be treated as "<code title="">text/plain</code>". If
the <var title="">format</var> is "<code title="">URL</code>", then
the data associated with the "<code title="">text/uri-list</code>"
format must be parsed as appropriate for <code title="">text/uri-list</code> data, and the first URL from the list
must be returned. If there is no data with that format, or if there
is but it has no URLs, then the method must return the empty
string. <a href=#refsRFC2483>[RFC2483]</a></p>
the <var title="">format</var> (after conversion to lowercase) is
"<code title="">url</code>", then the data associated with the
"<code title="">text/uri-list</code>" format must be parsed as
appropriate for <code title="">text/uri-list</code> data, and the
first URL from the list must be returned. If there is no data with
that format, or if there is but it has no URLs, then the method must
return the empty string. <a href=#refsRFC2483>[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 class=note>This version of the API does not expose the types of
the files during the drag.</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
Expand Down Expand Up @@ -61892,6 +61910,10 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
user agents must similarly use platform-specific conventions when
deciding on what drag feedback to use.</p>

<p>All the format strings must be <a href=#converted-to-ascii-lowercase>converted to ASCII
lowercase</a>. If the platform conventions do not use <a href=#mime-type title="MIME type">MIME types</a> to label the dragged data, the
user agent must map the types to MIME types first.</p>

<p>If a drag is started in a document but ends in another
application, then the user agent must instead replace the parts of
the processing model relating to handling the <em>target</em>
Expand Down

0 comments on commit b98e78b

Please sign in to comment.