Short URL: http://html5.org/r/2255
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 2255 | WF2: <input type=range> | 2008-10-01 02:38 |
Index: source =================================================================== --- source (revision 2254) +++ source (revision 2255) @@ -27430,12 +27430,138 @@ title="attr-input-type-range">Range</span> state, the rules in this section apply.</p> + <p>The <code>input</code> element represents a control for setting + the element's <span title="concept-fe-value">value</span> to a + string representing a number, but with the caveat that the exact + value is not important, letting UAs provide a simpler interface than + they do for the <span title="attr-input-type-number">Number</span> + state.</p> + + <p class="note">In this state, the range and step constraints are + enforced even during user input, and there is no way to set the + value to the empty string.</p> + + <p>If the element is <i title="concept-input-mutable">mutable</i>, + the user should allow the user to change the number represented by + its <span title="concept-fe-value">value</span>, as obtained from + applying the <span>rules for parsing floating point number + values</span> to it. User agents must not allow the user to set the + <span title="concept-fe-value">value</span> to a string that is not + a <span>valid floating point number</span>. If the user agent + provides a user interface for selecting a number, then the <span + title="concept-fe-value">value</span> must be set to a <span>valid + floating point number</span> representing the user's selection. User + agents must not allow the user to set the <span + title="concept-fe-value">value</span> to the empty string.</p> + + <p><strong>The <span>value sanitization algorithm</span> is as + follows:</strong> If the <span title="concept-fe-value">value</span> + of the element is not a <span>valid floating point number</span>, + then set it to a <span>valid floating point number</span> that + represents the <span + title="concept-input-value-default-range">default value</span>.</p> + + <p>The <code title="attr-input-min">min</code> attribute, if + specified, must have a value that is a <span>valid floating point + number</span>. The <span title="concept-input-min-default">default + minimum</span> is 0. The <code title="attr-input-max">max</code> + attribute, if specified, must have a value that is a <span>valid + floating point number</span>. The <span + title="concept-input-min-default">default minimum</span> is 100.</p> + + <p>The <dfn title="concept-input-value-default-range">default + value</dfn> is the <span title="concept-input-min">minimum</span> + plus half the difference between the <span + title="concept-input-min">minimum</span> and the <span + title="concept-input-max">maximum</span>, unless the <span + title="concept-input-max">maximum</span> is less than the <span + title="concept-input-min">minimum</span>, in which case the <span + title="concept-input-value-default-range">default value</span> is + the <span title="concept-input-min">minimum</span>.</p> + + <p>When the element is <span>suffering from a range + underflow</span>, the user agent must set the element's <span + title="concept-fe-value">value</span> to a <span>valid floating point + number</span> that represents the <span + title="concept-input-min">minimum</span>.</p> + + <p>When the element is <span>suffering from a range overflow</span>, + if the <span title="concept-input-max">maximum</span> is not less + than the <span title="concept-input-min">minimum</span>, the user + agent must set the element's <span + title="concept-fe-value">value</span> to a <span>valid floating point + number</span> that represents the <span + title="concept-input-max">maximum</span>.</p> + + <p>The <span title="concept-input-step-scale">step scale + factor</span> is 1. The <span + title="concept-input-step-default">default step</span> is 1 + (allowing only integers, unless the <code + title="attr-input-min">min</code> attribute has a non-integer + value).</p> + + <p>When the element is <span>suffering from a step mismatch</span>, + the user agent must round the element's <span + title="concept-fe-value">value</span> to the nearest number for + which the element would not <span title="suffering from a step + mismatch">suffer from a step mismatch</span>, and which is greater + than or equal to the <span title="concept-input-min">minimum</span>, + and, if the <span title="concept-input-max">maximum</span> is not + less than the <span title="concept-input-min">minimum</span>, which + is less than or equal to the <span + title="concept-input-max">maximum</span>.</p> + + <p><strong>The <span + title="concept-input-value-string-number">algorithm to convert a + string to a number</span>, given a string <var title="">input</var>, + is as follows:</strong> If applying the <span>rules for parsing + floating point number values</span> to <var title="">input</var> + results in an error, then return an error; otherwise, return the + resulting number.</p> + + <p><strong>The <span + title="concept-input-value-number-string">algorithm to convert a + number to a string</span>, given a number <var title="">input</var>, + is as follows:</strong> Return a <span>valid floating point + number</span> that represents <var title="">input</var>.</p> + + <p>The following common <code>input</code> element content + attributes, DOM attributes, and methods apply to the element: + <code title="attr-input-autocomplete">autocomplete</code>, + <code title="attr-input-list">list</code>, + <code title="attr-input-max">max</code>, + <code title="attr-input-min">min</code>, + <code title="attr-input-readonly">readonly</code>, + <code title="attr-input-required">required</code>, and + <code title="attr-input-step">step</code> content attributes; + <code title="dom-input-list">list</code>, + <code title="dom-input-valueAsNumber">valueAsNumber</code>, + <code title="dom-input-selectedOption">selectedOption</code>, + <code title="dom-input-stepUp">stepUp()</code>, and + <code title="dom-input-stepDown">stepDown()</code> DOM attributes.</p> + + <p>The following content attributes must not be specified and do not + apply to the element: + <code class="no-backref" title="attr-input-accept">accept</code>, + <code class="no-backref" title="attr-input-alt">alt</code>, + <code class="no-backref" title="attr-input-checked">checked</code>, + <code class="no-backref" title="attr-input-maxlength">maxlength</code>, + <code class="no-backref" title="attr-input-pattern">pattern</code>, + <code class="no-backref" title="attr-input-size">size</code>, + <code class="no-backref" title="attr-input-src">src</code>, + <code class="no-backref" title="attr-fs-target">target</code>, + <code class="no-backref" title="attr-fs-method">method</code>, + <code class="no-backref" title="attr-fs-enctype">enctype</code>, and + <code class="no-backref" title="attr-fs-action">action</code>.</p> + + <p>The following DOM attributes do not apply to the element: + <code class="no-backref" title="dom-input-valueAsDate">valueAsDate</code> and + <code class="no-backref" title="dom-input-checked">checked</code>.</p> + <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>When an <code>input</code> element's <code @@ -27745,7 +27871,11 @@ 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 + title="concept-input-min">minimum</dfn>; otherwise, if the the <code + title="attr-input-type">type</code> attribute's current state + defines a <dfn title="concept-input-min-default">default + minimum</dfn>, then that is the <span + title="concept-input-min">minimum</span>; otherwise, the element has no <span title="concept-input-min">minimum</span>.)</p> <p><strong>Constraint validation:</strong> When the element has a @@ -27768,7 +27898,11 @@ string to a number</span> to the value of the <code 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 + title="concept-input-max">maximum</dfn>; otherwise, if the the <code + title="attr-input-type">type</code> attribute's current state + defines a <dfn title="concept-input-max-default">default + maximum</dfn>, then that is the <span + title="concept-input-max">maximum</span>; otherwise, the element has no <span title="concept-input-max">maximum</span>.)</p> <p><strong>Constraint validation:</strong> When the element has a