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

Jonathan Watt jwatt at jwatt.org
Thu Jan 17 11:57:12 PST 2013

On 17/01/2013 19:29, Jonathan Watt wrote:
> 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

An alternative reading of the paragraph beginning "When the element is suffering 
from a step mismatch" would be that there is no value that can satisfy the 
constraints of being both greater than or equal to the minimum, less than or 
equal to the maximum, and not suffer from a step mismatch. In which case the 
spec doesn't seem to define the behavior. Changing the step base text to refer 
to "minimum" instead of "'min' content attribute" would also fix things from 
that perspective.


> 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