Skip to content
Permalink
Browse files

[] (0) WF2: stepUp/stepDown shouldn't go out of range. Allow rounding…

… of datetime controls.

git-svn-id: http://svn.whatwg.org/webapps@2247 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Sep 30, 2008
1 parent c7113be commit bbc5844668526b9a870751ca43b2f5f08269012a
Showing with 146 additions and 57 deletions.
  1. +79 −32 index
  2. +67 −25 source
111 index
title=concept-input-step-scale>step scale factor</a> is 1000 (which
converts the seconds to milliseconds, as used in the other algorithms).
The <a href="#default2" title=concept-input-step-default>default step</a>
is 60 seconds.</p>
<!-- XXX allow rounding -->
is 60 seconds.

<p>When the element is <a href="#suffering3">suffering from a step
mismatch</a>, the user agent may round the element's <span
title=concept-input-value>value</span> to the nearest date and time for
which the element would not <a href="#suffering3" title="suffering from a
step mismatch">suffer from a step mismatch</a>.

<hr>

the <a href="#range1" title=attr-input-type-range>Range</a> state, the
rules in this section apply.

<p class=big-issue>...
<p class=big-issue>...</p>
<!-- XXX default min/max, calling valueAsNumber with out-of-range values -->

<h6 id=checkbox><span class=secno>4.10.4.1.13. </span><dfn id=checkbox1
title=attr-input-type-checkbox>Checkbox</dfn> state</h6>
title=attr-input-type><a href="#type14">type</a></code> attribute's
current state.

<p><strong>Constraint validation:</strong> When the element has a <code
title=attr-input-min><a href="#min2">min</a></code> attribute, and the
result of applying the <a href="#algorithm5"
title=concept-input-value-string-number>algorithm to convert a string to a
number</a> to the string given by the element's <a href="#value12"
title=concept-fe-value>value</a> is a number, and the result of applying
<p>If the element has a <code title=attr-input-min><a
href="#min2">min</a></code> attribute, and the result of applying the <a
href="#algorithm5" title=concept-input-value-string-number>algorithm to
convert a string to a number</a> to the value of the <code
title=attr-input-min><a href="#min2">min</a></code> attribute is a a
number, then that number is the element's <dfn id=minimum
title=concept-input-min>minimum</dfn>. (Otherwise, the element has no <a
href="#minimum" title=concept-input-min>minimum</a>.)

<p><strong>Constraint validation:</strong> When the element has a <a
href="#min2" title=attr-input-min>minimum</a>, and the result of applying
the <a href="#algorithm5"
title=concept-input-value-string-number>algorithm to convert a string to a
number</a> to the value of the <code title=attr-input-min><a
href="#min2">min</a></code> attribute is also a number, and the number
obtained from the former is less than the number obtained from the latter,
the element is <a href="#suffering1">suffering from an underflow</a>.

<p><strong>Constraint validation:</strong> When the element has a <code
title=attr-input-max><a href="#max4">max</a></code> attribute, and the
result of applying the <a href="#algorithm5"
title=concept-input-value-string-number>algorithm to convert a string to a
number</a> to the string given by the element's <a href="#value12"
title=concept-fe-value>value</a> is a number, and the result of applying
the <a href="#algorithm5"
title=concept-input-value-string-number>algorithm to convert a string to a
number</a> to the value of the <code title=attr-input-max><a
href="#max4">max</a></code> attribute is also a number, and the number
obtained from the former is greater than the number obtained from the
latter, the element is <a href="#suffering2">suffering from an
overflow</a>.
title=concept-fe-value>value</a> is a number, and the number obtained from
that algorithm is less than the <a href="#min2"
title=attr-input-min>minimum</a>, the element is <a
href="#suffering1">suffering from an underflow</a>.

<p>The <code title=attr-input-min><a href="#min2">min</a></code> attribute
also defines the <a href="#step-base" title=concept-input-min-zero>step
base</a>.

<p>If the element has a <code title=attr-input-max><a
href="#max4">max</a></code> attribute, and the result of applying the <a
href="#algorithm5" title=concept-input-value-string-number>algorithm to
convert a string to a number</a> to the value of the <code
title=attr-input-max><a href="#max4">max</a></code> attribute is a a
number, then that number is the element's <dfn id=maximum0
title=concept-input-max>maximum</dfn>. (Otherwise, the element has no <a
href="#maximum0" title=concept-input-max>maximum</a>.)

<p><strong>Constraint validation:</strong> When the element has a <a
href="#max4" title=attr-input-max>maximum</a>, and the result of applying
the <a href="#algorithm5"
title=concept-input-value-string-number>algorithm to convert a string to a
number</a> to the string given by the element's <a href="#value12"
title=concept-fe-value>value</a> is a number, and the number obtained from
that algorithm is more than the <a href="#max4"
title=attr-input-max>maximum</a>, the element is <a
href="#suffering2">suffering from an overflow</a>.

<p>The <code title=attr-input-max><a href="#max4">max</a></code>
attribute's value (the <a href="#maximum0"
title=concept-input-max>maximum</a>) must not be less than the <code
title=attr-input-min><a href="#min2">min</a></code> attribute's value (its
<a href="#minimum" title=concept-input-min>minimum</a>).

<p class=note>If an element has a <a href="#max4"
title=attr-input-max>maximum</a> that is less than its <a href="#min2"
title=attr-input-min>minimum</a>, then so long as the element has a <a
href="#value12" title=concept-fe-value>value</a>, it will either be <a
href="#suffering1">suffering from an underflow</a> or <a
href="#suffering2">suffering from an overflow</a>.

<h6 id=the-step><span class=secno>4.10.4.2.5. </span>The <code
title=attr-input-step><a href="#step0">step</a></code> attribute</h6>


<li>
<p>If the element has no <a href="#allowed"
title=concept-input-step>allowed value step</a>, then throw a
title=concept-input-step>allowed value step</a>, then throw an
<code>INVALID_ACCESS_ERR</code> exception, and abort these steps.

<li>
title="">value</var>.

<li>
<p>Run the <a href="#algorithm6"
title=concept-input-value-number-string>algorithm to convert a number to
a string</a>, as defined for the <code><a
<p>Let <var title="">value as string</var> be the result of running the
<a href="#algorithm6" title=concept-input-value-number-string>algorithm
to convert a number to a string</a>, as defined for the <code><a
href="#input0">input</a></code> element's <code title=attr-input-type><a
href="#type14">type</a></code> attribute's current state, on <var
title="">value</var>, and set the <a href="#value12"
title=concept-fe-value>value</a> of the element to the resulting string.
title="">value</var>.

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

<li>
<p>If the element has a <a href="#maximum0"
title=concept-input-max>maximum</a>, and the <var title="">value</var>
is greater than that <a href="#maximum0"
title=concept-input-max>maximum</a>, then throw a
<code>INVALID_ACCESS_ERR</code> exception.

<li>
<p>Set the <a href="#value12" title=concept-fe-value>value</a> of the
element to <var title="">value as string</var>.
</ol>

<h6 id=others...><span class=secno>4.10.4.3.2. </span>Others...</h6>
92 source
algorithms). The <span title="concept-input-step-default">default
step</span> is 60 seconds.</p>

<!-- XXX allow rounding -->
<p>When the element is <span>suffering from a step mismatch</span>,
the user agent may round the element's <span
title="concept-input-value">value</span> to the nearest date and
time for which the element would not <span title="suffering from a
step mismatch">suffer from a step mismatch</span>.</p>

<hr>


<p class="big-issue">...</p>

<!-- XXX default min/max, calling valueAsNumber with out-of-range values -->



<h6><dfn title="attr-input-type-checkbox">Checkbox</dfn> state</h6>
<p>Their syntax is defined by the section that defines the <code
title="attr-input-type">type</code> attribute's current state.</p>

<p>If the element has a <code title="attr-input-min">min</code>
attribute, and the result of applying the <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span> to the value of the <code
title="attr-input-min">min</code> attribute is a a number, then that
number is the element's <dfn
title="concept-input-min">minimum</dfn>. (Otherwise, the element has
no <span title="concept-input-min">minimum</span>.)</p>

<p><strong>Constraint validation:</strong> When the element has a
<code title="attr-input-min">min</code> attribute, and the result of
<span title="attr-input-min">minimum</span>, and the result of
applying the <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span> to the string given by the element's <span
title="concept-fe-value">value</span> is a number, and the result
of applying the <span
title="concept-fe-value">value</span> is a number, and the number
obtained from that algorithm is less than the <span
title="attr-input-min">minimum</span>, the element is
<span>suffering from an underflow</span>.</p>

<p>The <code title="attr-input-min">min</code> attribute also
defines the <span title="concept-input-min-zero">step
base</span>.</p>

<p>If the element has a <code title="attr-input-max">max</code>
attribute, and the result of applying the <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span> to the value of the <code
title="attr-input-min">min</code> attribute is also a number, and
the number obtained from the former is less than the number obtained
from the latter, the element is <span>suffering from an
underflow</span>.</p>
title="attr-input-max">max</code> attribute is a a number, then that
number is the element's <dfn
title="concept-input-max">maximum</dfn>. (Otherwise, the element has
no <span title="concept-input-max">maximum</span>.)</p>

<p><strong>Constraint validation:</strong> When the element has a
<code title="attr-input-max">max</code> attribute, and the result of
<span title="attr-input-max">maximum</span>, and the result of
applying the <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span> to the string given by the element's <span
title="concept-fe-value">value</span> is a number, and the result
of applying the <span
title="concept-input-value-string-number">algorithm to convert a
string to a number</span> to the value of the <code
title="attr-input-max">max</code> attribute is also a number, and
the number obtained from the former is greater than the number
obtained from the latter, the element is <span>suffering from an
title="concept-fe-value">value</span> is a number, and the number
obtained from that algorithm is more than the <span
title="attr-input-max">maximum</span>, the element is
<span>suffering from an overflow</span>.</p>

<p>The <code title="attr-input-max">max</code> attribute's value
(the <span title="concept-input-max">maximum</span>) must not be
less than the <code title="attr-input-min">min</code> attribute's
value (its <span title="concept-input-min">minimum</span>).</p>

<p class="note">If an element has a <span
title="attr-input-max">maximum</span> that is less than its <span
title="attr-input-min">minimum</span>, then so long as the element
has a <span title="concept-fe-value">value</span>, it will either be
<span>suffering from an underflow</span> or <span>suffering from an
overflow</span>.</p>

<p>The <code title="attr-input-min">min</code> attribute also
defines the <span title="concept-input-min-zero">step
base</span>.</p>


<h6>The <code title="attr-input-step">step</code> attribute</h6>

steps.</p></li>

<li><p>If the element has no <span
title="concept-input-step">allowed value step</span>, then throw a
title="concept-input-step">allowed value step</span>, then throw an
<code>INVALID_ACCESS_ERR</code> exception, and abort these
steps.</p></li>

<span title="concept-input-step">allowed value step</span> to <var
title="">value</var>.</p></li>

<li><p>Run the <span
<li><p>Let <var title="">value as string</var> be the result of
running the <span
title="concept-input-value-number-string">algorithm to convert a
number to a string</span>, as defined for the <code>input</code>
element's <code title="attr-input-type">type</code> attribute's
current state, on <var title="">value</var>, and set the <span
title="concept-fe-value">value</span> of the element to the
resulting string.</p></li>
current state, on <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 throw a
<code>INVALID_ACCESS_ERR</code> exception.</p></li>

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

<li><p>Set the <span title="concept-fe-value">value</span> of the
element to <var title="">value as string</var>.</p></li>

</ol>

0 comments on commit bbc5844

Please sign in to comment.
You can’t perform that action at this time.