Skip to content

Commit

Permalink
Do not change input/textarea text selection for the same value
Browse files Browse the repository at this point in the history
Fixes #2412.
  • Loading branch information
domenic committed Mar 14, 2017
1 parent 7163372 commit 8408edc
Showing 1 changed file with 56 additions and 26 deletions.
82 changes: 56 additions & 26 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -48059,48 +48059,66 @@ You cannot submit this form when the field is incorrect.</samp></pre>

<dd>

<p>On getting, it must return the current <span data-x="concept-fe-value">value</span> of the
element. On setting, it must set the element's <span data-x="concept-fe-value">value</span> to
the new value, set the element's <span data-x="concept-input-value-dirty-flag">dirty value
flag</span> to true, invoke the <span>value sanitization algorithm</span>, if the element's
<code data-x="attr-input-type">type</code> attribute's current state defines one, and then, if
the element has a text entry cursor position, should move the text entry cursor position to the
end of the text control, unselecting any selected text and resetting the selection direction to
<i>none</i>.</p>
<p>On getting, return the current <span data-x="concept-fe-value">value</span> of the
element.</p>

<p>On setting:</p>

<ol>
<li><p>Let <var>oldValue</var> be the element's <span
data-x="concept-fe-value">value</span>.</p></li>

<li><p>Set the element's <span data-x="concept-fe-value">value</span> to the new
value.</p></li>

<li><p>Set the element's <span data-x="concept-input-value-dirty-flag">dirty value flag</span>
to true.</p></li>

<li><p>Invoke the <span>value sanitization algorithm</span>, if the element's <code
data-x="attr-input-type">type</code> attribute's current state defines one.</p></li>

<li><p>If the new value is different from <var>oldValue</var> and the element has a text entry
cursor position, move the text entry cursor position to the end of the text control,
unselecting any selected text and resetting the selection direction to <i>none</i>.</p></li>
</ol>

</dd>

<dt><dfn data-x="dom-input-value-default">default</dfn>

<dd>

<p>On getting, if the element has a <code data-x="attr-input-value">value</code> attribute, it
must return that attribute's value; otherwise, it must return the empty string. On setting, it
must set the element's <code data-x="attr-input-value">value</code> attribute to the new
value.</p>
<p>On getting, if the element has a <code data-x="attr-input-value">value</code> content
attribute, return that attribute's value; otherwise, it return the empty string.</p>

<p>On setting, set the value of the element's <code data-x="attr-input-value">value</code>
content attribute to the new value.</p>

</dd>

<dt><dfn data-x="dom-input-value-default-on">default/on</dfn>

<dd>

<p>On getting, if the element has a <code data-x="attr-input-value">value</code> attribute, it
must return that attribute's value; otherwise, it must return the string "<code
data-x="">on</code>". On setting, it must set the element's <code
data-x="attr-input-value">value</code> attribute to the new value.</p>
<p>On getting, if the element has a <code data-x="attr-input-value">value</code> content
attribute, return that attribute's value; otherwise, return the string "<code
data-x="">on</code>".</p>

<p>On setting, set the value of the element's <code data-x="attr-input-value">value</code>
content attribute to the new value.</p>

</dd>

<dt><dfn data-x="dom-input-value-filename">filename</dfn>

<dd id="fakepath-orly">

<p>On getting, it must return the string "<code data-x="">C:\fakepath\</code>" followed by the
name of the first file in the list of <span data-x="concept-input-type-file-selected">selected
files</span>, if any, or the empty string if the list is empty. On setting, if the new value is
the empty string, it must empty the list of <span
data-x="concept-input-type-file-selected">selected files</span>; otherwise, it must throw an
<p>On getting, return the string "<code data-x="">C:\fakepath\</code>" followed by the name of
the first file in the list of <span data-x="concept-input-type-file-selected">selected
files</span>, if any, or the empty string if the list is empty.</p>

<p>On setting, if the new value is the empty string, empty the list of <span
data-x="concept-input-type-file-selected">selected files</span>; otherwise, throw an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p>

<p class="note">This "fakepath" requirement is a sad accident of history. See <a
Expand Down Expand Up @@ -50038,11 +50056,23 @@ interface <dfn>HTMLTextAreaElement</dfn> : <span>HTMLElement</span> {
act like the element's <code>textContent</code> IDL attribute.</p>

<p>The <dfn><code data-x="dom-textarea-value">value</code></dfn> IDL attribute must, on getting,
return the element's <span data-x="concept-fe-api-value">API value</span>; on setting, it must set
the element's <span data-x="concept-textarea-raw-value">raw value</span> to the new value, set the
element's <span data-x="concept-textarea-dirty">dirty value flag</span> to true,
and should then move the text entry cursor position to the end of the text control, unselecting
any selected text and resetting the selection direction to <i>none</i>.</p>
return the element's <span data-x="concept-fe-api-value">API value</span>. On setting, it must
perform the following steps:</p>

<ol>
<li><p>Let <var>oldRawValue</var> be this element's <span data-x="concept-textarea-raw-value">raw
value</span>.</p></li>

<li><p>Set this element's <span data-x="concept-textarea-raw-value">raw value</span> to the new
value.</p></li>

<li><p>Set this element's <span data-x="concept-textarea-dirty">dirty value flag</span> to
true.</p></li>

<li><p>If the new value is different from <var>oldRawValue</var>, move the text entry cursor
position to the end of the text control, unselecting any selected text and resetting the
selection direction to <i>none</i>.</p></li>
</ol>

<p>The <dfn><code data-x="dom-textarea-textLength">textLength</code></dfn> IDL attribute must
return the <span>code-unit length</span> of the element's <span data-x="concept-fe-api-value">API
Expand Down

0 comments on commit 8408edc

Please sign in to comment.