Skip to content

Commit

Permalink
[giow] (1) drag-and-drop: handle drags to text fields properly
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@4280 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 23, 2009
1 parent 7e2e780 commit 66df643
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 97 deletions.
93 changes: 61 additions & 32 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -61993,42 +61993,54 @@ <h4 id=drag-and-drop-processing-model><span class=secno>8.9.4 </span>Drag-and-dr
element</a>, then the <a href=#current-target-element>current target element</a> must
be updated, as follows:</p>

<ol><li>

<p>If the new <a href=#immediate-user-selection>immediate user selection</a> is null, or
is in a non-DOM document or application, then set the
<a href=#current-target-element>current target element</a> to the same value.</p>
<dl class=switch><dt>If the new <a href=#immediate-user-selection>immediate user selection</a> is null, or
is in a non-DOM document or application</dt>

<li>
<dd><p>The user agent must set the <a href=#current-target-element>current target
element</a> to the same value.</dd>

<p>Otherwise, the user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at the
<a href=#immediate-user-selection>immediate user selection</a>.</p>
<dt>Otherwise</dt>

</li>
<dd>

<li>
<p>The user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at the
<a href=#immediate-user-selection>immediate user selection</a>.</p>

<p>If the event is canceled, then the <a href=#current-target-element>current target
element</a> must be set to the <a href=#immediate-user-selection>immediate user
selection</a>.</p>

</li>
<p>Otherwise, the user agent must act as follows:</p>

<li>
<dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text
field (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code>
element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code>
attribute is in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
<a href=#editable>editable</a> element</dt>

<p>Otherwise, if the <a href=#current-target-element>current target element</a> is
not <a href=#the-body-element>the body element</a>, the user agent must fire a
<code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at
<a href=#the-body-element>the body element</a>, and the <a href=#current-target-element>current target
element</a> must be set to <a href=#the-body-element>the body element</a>,
regardless of whether that event was canceled or not. (If
<a href=#the-body-element>the body element</a> is null, then the <a href=#current-target-element>current
target element</a> would be set to null too in this case,
it wouldn't be set to the <code>Document</code> object.)</p>
<dd><p>The <a href=#current-target-element>current target element</a> must be set to
the <a href=#immediate-user-selection>immediate user selection</a> anyway.</dd>

</li>
<dt>If the <a href=#current-target-element>current target element</a> is
<a href=#the-body-element>the body element</a></dt>

</ol></li>
<dd><p>The <a href=#current-target-element>current target element</a> is left
unchanged.</dd>

<dt>Otherwise</dt>

<dd><p>The user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at <a href=#the-body-element>the
body element</a>, and the <a href=#current-target-element>current target
element</a> must be set to <a href=#the-body-element>the body element</a>,
regardless of whether that event was canceled or not. (If
<a href=#the-body-element>the body element</a> is null, then the <a href=#current-target-element>current
target element</a> would be set to null too in this case,
it wouldn't be set to the <code>Document</code>
object.)</dd>

</dl></dd>

</dl></li>

<li>

Expand All @@ -62047,11 +62059,26 @@ <h4 id=drag-and-drop-processing-model><span class=secno>8.9.4 </span>Drag-and-dr
target element</a>.</p>

<p>If the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event is
not canceled, the <a href=#current-drag-operation>current drag operation</a> must be
reset to "none".</p>
not canceled, the user agent must act as follows:</p>

<dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
(e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
<a href=#editable>editable</a> element</dt>

<dd><p>The user agent must set the <a href=#current-drag-operation>current drag
operation</a> to either "copy" or "move", as appropriate
given the platform conventions.</dd>

<dt>Otherwise</dt>

<dd><p>The user agent must reset the <a href=#current-drag-operation>current drag
operation</a> to "none".</dd>

<p>Otherwise, the <a href=#current-drag-operation>current drag operation</a> must be
set based on the values the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and
</dl><p>Otherwise (if the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event <em>is</em>
canceled), the <a href=#current-drag-operation>current drag operation</a> must be set
based on the values the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and
<code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code>
attributes of the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object
had after the event was handled, as per the following table:</p>
Expand Down Expand Up @@ -62148,13 +62175,15 @@ <h4 id=drag-and-drop-processing-model><span class=secno>8.9.4 </span>Drag-and-dr
<dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
(e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state)</dt>
the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
<a href=#editable>editable</a> element</dt>

<dd>The user agent must insert the data associated with the
<code>text/plain</code> format, if any, into the text field in
a manner consistent with platform-specific conventions
(e.g. inserting it at the current mouse cursor position, or
inserting it at the end of the field).</dd>
<code>text/plain</code> format, if any, into the text field or
<a href=#editable>editable</a> element in a manner consistent with
platform-specific conventions (e.g. inserting it at the current
mouse cursor position, or inserting it at the end of the
field).</dd>

<dt>Otherwise</dt>

Expand Down
93 changes: 61 additions & 32 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -57506,42 +57506,54 @@ NETWORK:
element</a>, then the <a href=#current-target-element>current target element</a> must
be updated, as follows:</p>

<ol><li>

<p>If the new <a href=#immediate-user-selection>immediate user selection</a> is null, or
is in a non-DOM document or application, then set the
<a href=#current-target-element>current target element</a> to the same value.</p>
<dl class=switch><dt>If the new <a href=#immediate-user-selection>immediate user selection</a> is null, or
is in a non-DOM document or application</dt>

<li>
<dd><p>The user agent must set the <a href=#current-target-element>current target
element</a> to the same value.</dd>

<p>Otherwise, the user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at the
<a href=#immediate-user-selection>immediate user selection</a>.</p>
<dt>Otherwise</dt>

</li>
<dd>

<li>
<p>The user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at the
<a href=#immediate-user-selection>immediate user selection</a>.</p>

<p>If the event is canceled, then the <a href=#current-target-element>current target
element</a> must be set to the <a href=#immediate-user-selection>immediate user
selection</a>.</p>

</li>
<p>Otherwise, the user agent must act as follows:</p>

<li>
<dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text
field (e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code>
element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code>
attribute is in the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
<a href=#editable>editable</a> element</dt>

<p>Otherwise, if the <a href=#current-target-element>current target element</a> is
not <a href=#the-body-element>the body element</a>, the user agent must fire a
<code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at
<a href=#the-body-element>the body element</a>, and the <a href=#current-target-element>current target
element</a> must be set to <a href=#the-body-element>the body element</a>,
regardless of whether that event was canceled or not. (If
<a href=#the-body-element>the body element</a> is null, then the <a href=#current-target-element>current
target element</a> would be set to null too in this case,
it wouldn't be set to the <code>Document</code> object.)</p>
<dd><p>The <a href=#current-target-element>current target element</a> must be set to
the <a href=#immediate-user-selection>immediate user selection</a> anyway.</dd>

</li>
<dt>If the <a href=#current-target-element>current target element</a> is
<a href=#the-body-element>the body element</a></dt>

</ol></li>
<dd><p>The <a href=#current-target-element>current target element</a> is left
unchanged.</dd>

<dt>Otherwise</dt>

<dd><p>The user agent must fire a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event at <a href=#the-body-element>the
body element</a>, and the <a href=#current-target-element>current target
element</a> must be set to <a href=#the-body-element>the body element</a>,
regardless of whether that event was canceled or not. (If
<a href=#the-body-element>the body element</a> is null, then the <a href=#current-target-element>current
target element</a> would be set to null too in this case,
it wouldn't be set to the <code>Document</code>
object.)</dd>

</dl></dd>

</dl></li>

<li>

Expand All @@ -57560,11 +57572,26 @@ NETWORK:
target element</a>.</p>

<p>If the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event is
not canceled, the <a href=#current-drag-operation>current drag operation</a> must be
reset to "none".</p>
not canceled, the user agent must act as follows:</p>

<dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
(e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
<a href=#editable>editable</a> element</dt>

<dd><p>The user agent must set the <a href=#current-drag-operation>current drag
operation</a> to either "copy" or "move", as appropriate
given the platform conventions.</dd>

<dt>Otherwise</dt>

<dd><p>The user agent must reset the <a href=#current-drag-operation>current drag
operation</a> to "none".</dd>

<p>Otherwise, the <a href=#current-drag-operation>current drag operation</a> must be
set based on the values the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and
</dl><p>Otherwise (if the <code title=event-dragover><a href=#event-dragover>dragover</a></code> event <em>is</em>
canceled), the <a href=#current-drag-operation>current drag operation</a> must be set
based on the values the <code title=dom-DataTransfer-effectAllowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and
<code title=dom-DataTransfer-dropEffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code>
attributes of the <code title=dom-DragEvent-dataTransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> object
had after the event was handled, as per the following table:</p>
Expand Down Expand Up @@ -57661,13 +57688,15 @@ NETWORK:
<dl class=switch><dt>If the <a href=#current-target-element>current target element</a> is a text field
(e.g. <code><a href=#the-textarea-element>textarea</a></code>, or an <code><a href=#the-input-element>input</a></code> element
whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state)</dt>
the <a href=#text-state-and-search-state title=attr-input-type-text>Text</a> state) or an
<a href=#editable>editable</a> element</dt>

<dd>The user agent must insert the data associated with the
<code>text/plain</code> format, if any, into the text field in
a manner consistent with platform-specific conventions
(e.g. inserting it at the current mouse cursor position, or
inserting it at the end of the field).</dd>
<code>text/plain</code> format, if any, into the text field or
<a href=#editable>editable</a> element in a manner consistent with
platform-specific conventions (e.g. inserting it at the current
mouse cursor position, or inserting it at the end of the
field).</dd>

<dt>Otherwise</dt>

Expand Down
Loading

0 comments on commit 66df643

Please sign in to comment.