[whatwg] Implementation issue: step mismatch handling for <input type=range>

Jonathan Watt jwatt at jwatt.org
Thu Jan 17 11:29:44 PST 2013


I'm working on implementing <input type=range> for Gecko and have encountered 
what I believe to be an issue in the spec.

Step 1 of the algorithm to find the "step base":

http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#concept-input-min-zero

says "If the element has a min content attribute...to the value of the min 
content attribute...". Should this not talk about "minimum" rather than "min 
content attribute"? It would otherwise seem to give bad results in the case of 
<input type=range>, which has a default minimum of zero (a default minimum makes 
sense in the case of type=range, since an unbounded slider would be impossible 
for a user to interact with). Consider for example:

   <input type=range value=-1 max=1 step=3>

As it stands, the current spec text says that the "step base" is -1 (from the 
'value' content attribute), the 'minimum' is zero (from the default minimum), 
the 'maximum' is 1, and the step is 3. As a result, an implementation would seem 
to be directed to enter an infinite loop applying the paragraphs beginning with 
"When the element is suffering from an underflow..." and "When the element is 
suffering from a step mismatch..." in:

http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#range-state-%28type=range%29

If the step base considered the 'minimum' instead of the 'min' content 
attribute, then the step base would be zero, and thus the value would settle at 
zero.

Jonathan



More information about the whatwg mailing list