Skip to content

Commit

Permalink
[iw] (2) drag-and-drop: add dataTransfer.types; remove the limitation…
Browse files Browse the repository at this point in the history
… that copy/paste only be for text; remove bogus requirements; add placeholder for intro section

git-svn-id: http://svn.whatwg.org/webapps@1227 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 15, 2008
1 parent b1c4d2e commit 393eca6
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 61 deletions.
87 changes: 43 additions & 44 deletions index
Expand Up @@ -24,7 +24,7 @@

<h1 id=html-5>HTML 5</h1>

<h2 class="no-num no-toc" id=working>Working Draft &mdash; 14 February
<h2 class="no-num no-toc" id=working>Working Draft &mdash; 15 February
2008</h2>

<p>You can take part in this work. <a
Expand Down Expand Up @@ -1365,42 +1365,45 @@

<li><a href="#dnd"><span class=secno>5.3 </span>Drag and drop</a>
<ul class=toc>
<li><a href="#the-dragevent"><span class=secno>5.3.1 </span>The
<li><a href="#introduction4"><span class=secno>5.3.1
</span>Introduction</a>

<li><a href="#the-dragevent"><span class=secno>5.3.2 </span>The
<code>DragEvent</code> and <code>DataTransfer</code> interfaces</a>

<li><a href="#events1"><span class=secno>5.3.2 </span>Events fired
<li><a href="#events1"><span class=secno>5.3.3 </span>Events fired
during a drag-and-drop action</a>

<li><a href="#drag-and-drop"><span class=secno>5.3.3
<li><a href="#drag-and-drop"><span class=secno>5.3.4
</span>Drag-and-drop processing model</a>
<ul class=toc>
<li><a href="#when-the"><span class=secno>5.3.3.1. </span>When the
<li><a href="#when-the"><span class=secno>5.3.4.1. </span>When the
drag-and-drop operation starts or ends in another document</a>

<li><a href="#when-the0"><span class=secno>5.3.3.2. </span>When the
<li><a href="#when-the0"><span class=secno>5.3.4.2. </span>When the
drag-and-drop operation starts or ends in another application</a>
</ul>

<li><a href="#the-draggable"><span class=secno>5.3.4 </span>The
<li><a href="#the-draggable"><span class=secno>5.3.5 </span>The
<code>draggable</code> attribute</a>

<li><a href="#copy-and"><span class=secno>5.3.5 </span>Copy and
<li><a href="#copy-and"><span class=secno>5.3.6 </span>Copy and
paste</a>
<ul class=toc>
<li><a href="#copy-to"><span class=secno>5.3.5.1. </span>Copy to
<li><a href="#copy-to"><span class=secno>5.3.6.1. </span>Copy to
clipboard</a>

<li><a href="#cut-to"><span class=secno>5.3.5.2. </span>Cut to
<li><a href="#cut-to"><span class=secno>5.3.6.2. </span>Cut to
clipboard</a>

<li><a href="#paste"><span class=secno>5.3.5.3. </span>Paste from
<li><a href="#paste"><span class=secno>5.3.6.3. </span>Paste from
clipboard</a>

<li><a href="#paste0"><span class=secno>5.3.5.4. </span>Paste from
<li><a href="#paste0"><span class=secno>5.3.6.4. </span>Paste from
selection</a>
</ul>

<li><a href="#security8"><span class=secno>5.3.6 </span>Security risks
<li><a href="#security8"><span class=secno>5.3.7 </span>Security risks
in the drag-and-drop model</a>
</ul>

Expand Down Expand Up @@ -33226,7 +33229,13 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
(so if the operation is not canceled, there must be at least one element
in the middle step).

<h4 id=the-dragevent><span class=secno>5.3.1 </span>The <code><a
<h4 id=introduction4><span class=secno>5.3.1 </span>Introduction</h4>

<p><em>This section is non-normative.</em>

<p class=big-issue>It's also currently non-existent.

<h4 id=the-dragevent><span class=secno>5.3.2 </span>The <code><a
href="#dragevent">DragEvent</a></code> and <code><a
href="#datatransfer0">DataTransfer</a></code> interfaces</h4>

Expand Down Expand Up @@ -33256,16 +33265,10 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
of the <code><a href="#dragevent">DragEvent</a></code> interface
represents the context information for the event.

<p>When a <code><a href="#dragevent">DragEvent</a></code> object is
created, a new <code><a href="#datatransfer0">DataTransfer</a></code>
object must be created and assigned to the <code
title=dom-DragEvent-dataTransfer><a
href="#datatransfer">dataTransfer</a></code> context information field of
the event object.

<pre class=idl>interface <dfn id=datatransfer0>DataTransfer</dfn> {
attribute DOMString <a href="#dropeffect" title=dom-DataTransfer-dropEffect>dropEffect</a>;
attribute DOMString <a href="#effectallowed" title=dom-DataTransfer-effectAllowed>effectAllowed</a>;
readonly attribute DOMStringList <a href="#types" title=dom-DataTransfer-types>types</a>;
void <a href="#cleardata" title=dom-DataTransfer-clearData>clearData</a>(in DOMString format);
void <a href="#setdata" title=dom-DataTransfer-setData>setData</a>(in DOMString format, in DOMString data);
DOMString <a href="#getdata" title=dom-DataTransfer-getData>getData</a>(in DOMString format);
Expand All @@ -33277,11 +33280,8 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<p><code><a href="#datatransfer0">DataTransfer</a></code> objects can
conceptually contain various kinds of data.

<p>When a <code><a href="#dragevent">DragEvent</a></code> event object is
initialised, the <code><a href="#datatransfer0">DataTransfer</a></code>
object created for the event's <code title=dom-DragEvent-dataTransfer><a
href="#datatransfer">dataTransfer</a></code> member must be initialised as
follows:
<p>When a <code><a href="#datatransfer0">DataTransfer</a></code> object is
created, it must be initialised as follows:

<ul>
<li>The <code><a href="#datatransfer0">DataTransfer</a></code> object must
Expand Down Expand Up @@ -33362,6 +33362,11 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
it has no URIs, then the method must return the empty string. <a
href="#refsRFC2483">[RFC2483]</a>

<p>The <dfn id=types title=dom-DataTransfer-types><code>types</code></dfn>
attribute must return a live <code>DOMStringList</code> that contains the
list of formats that are stored in the <code><a
href="#datatransfer0">DataTransfer</a></code> object.

<p>The <dfn id=setdragimage
title=dom-DataTransfer-setDragImage><code>setDragImage(<var
title="">element</var>, <var title="">x</var>, <var
Expand All @@ -33380,7 +33385,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
the drag feedback</a>. It adds an element to the <code><a
href="#datatransfer0">DataTransfer</a></code> object.

<h4 id=events1><span class=secno>5.3.2 </span>Events fired during a
<h4 id=events1><span class=secno>5.3.3 </span>Events fired during a
drag-and-drop action</h4>

<p>The following events are involved in the drag-and-drop model. Whenever
Expand Down Expand Up @@ -33634,7 +33639,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<td><code title="">copy</code>
</table>

<h4 id=drag-and-drop><span class=secno>5.3.3 </span>Drag-and-drop
<h4 id=drag-and-drop><span class=secno>5.3.4 </span>Drag-and-drop
processing model</h4>

<p>When the user attempts to begin a drag operation, the user agent must
Expand Down Expand Up @@ -34072,7 +34077,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
</ol>
</ol>

<h5 id=when-the><span class=secno>5.3.3.1. </span>When the drag-and-drop
<h5 id=when-the><span class=secno>5.3.4.1. </span>When the drag-and-drop
operation starts or ends in another document</h5>

<p>The model described above is independent of which <code>Document</code>
Expand All @@ -34083,7 +34088,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
source in the events to the target, or is that obvious enough from
the requirements in the event section above? -->

<h5 id=when-the0><span class=secno>5.3.3.2. </span>When the drag-and-drop
<h5 id=when-the0><span class=secno>5.3.4.2. </span>When the drag-and-drop
operation starts or ends in another application</h5>

<p>If the drag is initiated in another application, the <a
Expand All @@ -34107,7 +34112,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
ended in another application from the case of a drag-and-drop operation
being started or ended in another document from another domain.

<h4 id=the-draggable><span class=secno>5.3.4 </span>The <dfn id=draggable
<h4 id=the-draggable><span class=secno>5.3.5 </span>The <dfn id=draggable
title=attr-draggable><code>draggable</code></dfn> attribute</h4>

<p>All elements may have the <code title=attr-draggable><a
Expand Down Expand Up @@ -34157,7 +34162,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
href="#draggable">draggable</a></code> content attribute must be set to
the literal value <code title="">true</code>.

<h4 id=copy-and><span class=secno>5.3.5 </span>Copy and paste</h4>
<h4 id=copy-and><span class=secno>5.3.6 </span>Copy and paste</h4>

<p>Copy-and-paste is a form of drag-and-drop: the "copy" part is equivalent
to dragging content to another application (the "clipboard"), and the
Expand All @@ -34168,7 +34173,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
System) is equivalent to a drag-and-drop operation where the source is the
selection.

<h5 id=copy-to><span class=secno>5.3.5.1. </span>Copy to clipboard</h5>
<h5 id=copy-to><span class=secno>5.3.6.1. </span>Copy to clipboard</h5>

<p>When the user invokes a copy operation, the user agent must act as if
the user had invoked a drag on the current selection. If the drag-and-drop
Expand All @@ -34180,40 +34185,34 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
agent should then follow the relevant platform-specific conventions for
copy operations (e.g. updating the clipboard).

<h5 id=cut-to><span class=secno>5.3.5.2. </span>Cut to clipboard</h5>
<h5 id=cut-to><span class=secno>5.3.6.2. </span>Cut to clipboard</h5>

<p>When the user invokes a cut operation, the user agent must act as if the
user had invoked a copy operation (see the previous section), followed, if
the copy was completed successfully, by <a
href="#contenteditable-delete">a selection delete operation</a>.

<h5 id=paste><span class=secno>5.3.5.3. </span>Paste from clipboard</h5>
<h5 id=paste><span class=secno>5.3.6.3. </span>Paste from clipboard</h5>

<p>When the user invokes a clipboard paste operation, the user agent must
act as if the user had invoked a drag on a hypothetical application
representing the clipboard, setting the data associated with the drag as
the text from the keyboard (either as <code title="">text/plain</code> or
<code>text/uri-list</code>). If the contents of the clipboard cannot be
represented as text or URIs, then the paste operation must not have any
effect.
the content on the clipboard (in whatever formats are available).

<p>Then, the user agent must act as if the user had indicated (as the <a
href="#immediate">immediate user selection</a>) the element with the
keyboard focus, and then ended the drag-and-drop operation without
canceling it.

<h5 id=paste0><span class=secno>5.3.5.4. </span>Paste from selection</h5>
<h5 id=paste0><span class=secno>5.3.6.4. </span>Paste from selection</h5>

<p>When the user invokes a selection paste operation, the user agent must
act as if the user had invoked a drag on the current selection, then
indicated (as the <a href="#immediate">immediate user selection</a>) the
element with the keyboard focus, and then ended the drag-and-drop
operation without canceling it.

<p>If the contents of the selection cannot be represented as text or URIs,
then the paste operation must not have any effect.

<h4 id=security8><span class=secno>5.3.6 </span>Security risks in the
<h4 id=security8><span class=secno>5.3.7 </span>Security risks in the
drag-and-drop model</h4>

<p>User agents must not make the data added to the <code><a
Expand Down
34 changes: 17 additions & 17 deletions source
Expand Up @@ -30607,6 +30607,13 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
step).</p>


<h4>Introduction</h4>

<p><em>This section is non-normative.</em></p>

<p class="big-issue">It's also currently non-existent.</p>


<h4>The <code>DragEvent</code> and <code>DataTransfer</code> interfaces</h4>

<p>The drag-and-drop processing model involves several events. They
Expand Down Expand Up @@ -30635,15 +30642,10 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
attribute of the <code>DragEvent</code> interface represents the
context information for the event.</p>

<p>When a <code>DragEvent</code> object is created, a new
<code>DataTransfer</code> object must be created and assigned to the
<code title="dom-DragEvent-dataTransfer">dataTransfer</code>
context information field of the event object.</p>


<pre class="idl">interface <dfn>DataTransfer</dfn> {
attribute DOMString <span title="dom-DataTransfer-dropEffect">dropEffect</span>;
attribute DOMString <span title="dom-DataTransfer-effectAllowed">effectAllowed</span>;
readonly attribute DOMStringList <span title="dom-DataTransfer-types">types</span>;
void <span title="dom-DataTransfer-clearData">clearData</span>(in DOMString format);
void <span title="dom-DataTransfer-setData">setData</span>(in DOMString format, in DOMString data);
DOMString <span title="dom-DataTransfer-getData">getData</span>(in DOMString format);
Expand All @@ -30655,10 +30657,8 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<p><code>DataTransfer</code> objects can conceptually contain
various kinds of data.</p>

<p>When a <code>DragEvent</code> event object is initialised, the
<code>DataTransfer</code> object created for the event's <code
title="dom-DragEvent-dataTransfer">dataTransfer</code> member must
be initialised as follows:</p>
<p>When a <code>DataTransfer</code> object is created, it must be
initialised as follows:</p>

<ul>

Expand Down Expand Up @@ -30740,6 +30740,11 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
is but it has no URIs, then the method must return the empty
string. <a href="#refsRFC2483">[RFC2483]</a></p>

<p>The <dfn title="dom-DataTransfer-types"><code>types</code></dfn>
attribute must return a live <code>DOMStringList</code> that
contains the list of formats that are stored in the
<code>DataTransfer</code> object.</p>

<p>The <dfn
title="dom-DataTransfer-setDragImage"><code>setDragImage(<var
title="">element</var>, <var title="">x</var>, <var
Expand Down Expand Up @@ -31538,10 +31543,8 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
<p>When the user invokes a clipboard paste operation, the user agent
must act as if the user had invoked a drag on a hypothetical
application representing the clipboard, setting the data associated
with the drag as the text from the keyboard (either as <code
title="">text/plain</code> or <code>text/uri-list</code>). If the
contents of the clipboard cannot be represented as text or URIs,
then the paste operation must not have any effect.</p>
with the drag as the content on the clipboard (in whatever formats
are available).</p>

<p>Then, the user agent must act as if the user had indicated (as
the <span>immediate user selection</span>) the element with the
Expand All @@ -31557,9 +31560,6 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
element with the keyboard focus, and then ended the drag-and-drop
operation without canceling it.</p>

<p>If the contents of the selection cannot be represented as text or
URIs, then the paste operation must not have any effect.</p>



<h4>Security risks in the drag-and-drop model</h4>
Expand Down

0 comments on commit 393eca6

Please sign in to comment.