Skip to content

Commit

Permalink
[giow] (2) Change stepUp/stepDown algorithm to be more like typical UIs.
Browse files Browse the repository at this point in the history
Affected topics: DOM APIs

git-svn-id: http://svn.whatwg.org/webapps@7639 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jan 8, 2013
1 parent 9776623 commit 420e8a3
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 65 deletions.
42 changes: 22 additions & 20 deletions complete.html
Expand Up @@ -248,7 +248,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 7 January 2013</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 8 January 2013</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -51834,31 +51834,33 @@ <h5 id=common-input-element-apis><span class=secno>4.10.7.4 </span>Common <code>
string to a number</a> to the string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> results in an error, then abort these steps; otherwise, let
<var title="">value</var> be the result of that algorithm.</li>

<li><p>Let <var title="">n</var> be the argument, or 1 if the
argument was omitted.</li>
<li>

<li><p>Let <var title="">delta</var> be the <a href=#concept-input-step title=concept-input-step>allowed value step</a> multiplied by
<var title="">n</var>.</li>
<p>If <var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step
base</a> is not an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value
step</a>, then set <var title="">value</var> to the nearest value that, when subtracted from
the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and that is less than <var title="">value</var> if the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and more than <var title="">value</var>
otherwise.</p>

<li><p>If the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> method, negate <var title="">delta</var>.</li>
<p>Otherwise (<var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a> is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>), run the following substeps:</p>

<li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var title="">value</var>.</li>
<ol><li><p>Let <var title="">n</var> be the argument, or 1 if the argument was omitted.</li>

<li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a>, and the <var title="">value</var> is less than that <a href=#concept-input-min title=concept-input-min>minimum</a>, then set
<var title="">value</var> to <a href=#concept-input-min title=concept-input-min>minimum</a>.</li>
<li><p>Let <var title="">delta</var> be the <a href=#concept-input-step title=concept-input-step>allowed value
step</a> multiplied by <var title="">n</var>.</li>

<li><p>If the element has a <a href=#concept-input-max title=concept-input-max>maximum</a>, and the <var title="">value</var> is greater than that <a href=#concept-input-max title=concept-input-max>maximum</a>, then
set <var title="">value</var> to <a href=#concept-input-max title=concept-input-max>maximum</a>.</li>
<li><p>If the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> method,
negate <var title="">delta</var>.</li>

<li><p>If <var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step
base</a> is not an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value
step</a>, then set <var title="">value</var> to the nearest value that is greater than or
equal to the element's <a href=#concept-input-min title=concept-input-min>minimum</a>, if any, and less than or
equal to the element's <a href=#concept-input-max title=concept-input-max>maximum</a>, if any, that, when
subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral
multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, rounding down if the
method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and rounding up
otherwise.</li>
<li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var title="">value</var>.</li>

</ol></li>

<li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a>, and <var title="">value</var> is less than that <a href=#concept-input-min title=concept-input-min>minimum</a>, then abort
these steps.</li>

<li><p>If the element has a <a href=#concept-input-max title=concept-input-max>maximum</a>, and <var title="">value</var> is greater than that <a href=#concept-input-max title=concept-input-max>maximum</a>, then
abort these steps.</li>

<li><p>Let <var title="">value as string</var> be the result of
running the <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
Expand Down
42 changes: 22 additions & 20 deletions index
Expand Up @@ -248,7 +248,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 7 January 2013</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 8 January 2013</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -51834,31 +51834,33 @@ You cannot submit this form when the field is incorrect.</samp></pre>
string to a number</a> to the string given by the element's <a href=#concept-fe-value title=concept-fe-value>value</a> results in an error, then abort these steps; otherwise, let
<var title="">value</var> be the result of that algorithm.</li>

<li><p>Let <var title="">n</var> be the argument, or 1 if the
argument was omitted.</li>
<li>

<li><p>Let <var title="">delta</var> be the <a href=#concept-input-step title=concept-input-step>allowed value step</a> multiplied by
<var title="">n</var>.</li>
<p>If <var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step
base</a> is not an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value
step</a>, then set <var title="">value</var> to the nearest value that, when subtracted from
the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, and that is less than <var title="">value</var> if the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and more than <var title="">value</var>
otherwise.</p>

<li><p>If the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> method, negate <var title="">delta</var>.</li>
<p>Otherwise (<var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a> is an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>), run the following substeps:</p>

<li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var title="">value</var>.</li>
<ol><li><p>Let <var title="">n</var> be the argument, or 1 if the argument was omitted.</li>

<li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a>, and the <var title="">value</var> is less than that <a href=#concept-input-min title=concept-input-min>minimum</a>, then set
<var title="">value</var> to <a href=#concept-input-min title=concept-input-min>minimum</a>.</li>
<li><p>Let <var title="">delta</var> be the <a href=#concept-input-step title=concept-input-step>allowed value
step</a> multiplied by <var title="">n</var>.</li>

<li><p>If the element has a <a href=#concept-input-max title=concept-input-max>maximum</a>, and the <var title="">value</var> is greater than that <a href=#concept-input-max title=concept-input-max>maximum</a>, then
set <var title="">value</var> to <a href=#concept-input-max title=concept-input-max>maximum</a>.</li>
<li><p>If the method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> method,
negate <var title="">delta</var>.</li>

<li><p>If <var title="">value</var> subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step
base</a> is not an integral multiple of the <a href=#concept-input-step title=concept-input-step>allowed value
step</a>, then set <var title="">value</var> to the nearest value that is greater than or
equal to the element's <a href=#concept-input-min title=concept-input-min>minimum</a>, if any, and less than or
equal to the element's <a href=#concept-input-max title=concept-input-max>maximum</a>, if any, that, when
subtracted from the <a href=#concept-input-min-zero title=concept-input-min-zero>step base</a>, is an integral
multiple of the <a href=#concept-input-step title=concept-input-step>allowed value step</a>, rounding down if the
method invoked was the <code title=dom-input-stepDown><a href=#dom-input-stepdown>stepDown()</a></code> and rounding up
otherwise.</li>
<li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var title="">value</var>.</li>

</ol></li>

<li><p>If the element has a <a href=#concept-input-min title=concept-input-min>minimum</a>, and <var title="">value</var> is less than that <a href=#concept-input-min title=concept-input-min>minimum</a>, then abort
these steps.</li>

<li><p>If the element has a <a href=#concept-input-max title=concept-input-max>maximum</a>, and <var title="">value</var> is greater than that <a href=#concept-input-max title=concept-input-max>maximum</a>, then
abort these steps.</li>

<li><p>Let <var title="">value as string</var> be the result of
running the <a href=#concept-input-value-number-string title=concept-input-value-number-string>algorithm to convert a
Expand Down
58 changes: 33 additions & 25 deletions source
Expand Up @@ -60454,37 +60454,45 @@ You cannot submit this form when the field is incorrect.</samp></pre>
title="concept-fe-value">value</span> results in an error, then abort these steps; otherwise, let
<var title="">value</var> be the result of that algorithm.</p></li>

<li><p>Let <var title="">n</var> be the argument, or 1 if the
argument was omitted.</p></li>
<li>

<p>If <var title="">value</var> subtracted from the <span title="concept-input-min-zero">step
base</span> is not an integral multiple of the <span title="concept-input-step">allowed value
step</span>, then set <var title="">value</var> to the nearest value that, when subtracted from
the <span title="concept-input-min-zero">step base</span>, is an integral multiple of the <span
title="concept-input-step">allowed value step</span>, and that is less than <var
title="">value</var> if the method invoked was the <code
title="dom-input-stepDown">stepDown()</code> and more than <var title="">value</var>
otherwise.</p>

<p>Otherwise (<var title="">value</var> subtracted from the <span
title="concept-input-min-zero">step base</span> is an integral multiple of the <span
title="concept-input-step">allowed value step</span>), run the following substeps:</p>

<ol>

<li><p>Let <var title="">n</var> be the argument, or 1 if the argument was omitted.</p></li>

<li><p>Let <var title="">delta</var> be the <span
title="concept-input-step">allowed value step</span> multiplied by
<var title="">n</var>.</p></li>
<li><p>Let <var title="">delta</var> be the <span title="concept-input-step">allowed value
step</span> multiplied by <var title="">n</var>.</p></li>

<li><p>If the method invoked was the <code
title="dom-input-stepDown">stepDown()</code> method, negate <var
title="">delta</var>.</p></li>
<li><p>If the method invoked was the <code title="dom-input-stepDown">stepDown()</code> method,
negate <var title="">delta</var>.</p></li>

<li><p>Let <var title="">value</var> be the result of adding <var
title="">delta</var> to <var title="">value</var>.</p></li>
<li><p>Let <var title="">value</var> be the result of adding <var title="">delta</var> to <var
title="">value</var>.</p></li>

<li><p>If the element has a <span title="concept-input-min">minimum</span>, and the <var
title="">value</var> is less than that <span title="concept-input-min">minimum</span>, then set
<var title="">value</var> to <span title="concept-input-min">minimum</span>.</p></li>
</ol>

</li>

<li><p>If the element has a <span title="concept-input-max">maximum</span>, and the <var
<li><p>If the element has a <span title="concept-input-min">minimum</span>, and <var
title="">value</var> is less than that <span title="concept-input-min">minimum</span>, then abort
these steps.</p></li>

<li><p>If the element has a <span title="concept-input-max">maximum</span>, and <var
title="">value</var> is greater than that <span title="concept-input-max">maximum</span>, then
set <var title="">value</var> to <span title="concept-input-max">maximum</span>.</p></li>

<li><p>If <var title="">value</var> subtracted from the <span title="concept-input-min-zero">step
base</span> is not an integral multiple of the <span title="concept-input-step">allowed value
step</span>, then set <var title="">value</var> to the nearest value that is greater than or
equal to the element's <span title="concept-input-min">minimum</span>, if any, and less than or
equal to the element's <span title="concept-input-max">maximum</span>, if any, that, when
subtracted from the <span title="concept-input-min-zero">step base</span>, is an integral
multiple of the <span title="concept-input-step">allowed value step</span>, rounding down if the
method invoked was the <code title="dom-input-stepDown">stepDown()</code> and rounding up
otherwise.</p></li>
abort these steps.</p></li>

<li><p>Let <var title="">value as string</var> be the result of
running the <span
Expand Down

0 comments on commit 420e8a3

Please sign in to comment.