[whatwg] stepMismatch with value < min or value > max

Ian Hickson ian at hixie.ch
Thu Feb 11 20:14:33 PST 2010


On Mon, 16 Nov 2009, TAMURA, Kent wrote:
>
> <input type=number min=0 step=2 value='-1'>
> <input type=number min=0 max=4 step=2 value=5>
> 
> Should input.validity.stepMismatch return true in these cases?
> The spec simply says:
>    "that number subtracted from the step base is not an integral multiple
> of the allowed value step, the element is suffering from a step mismatch."
> and doesn't mention the relationship with rangeUnderflow and rangeOverflow.
> 
> So I think stepMismatch should work even if value is less than min or
> greater than max.  I'd like to clarify it.

For the first case:

   step scale factor = 1
   allowed value step = 2 * 1 = 2
   step base = 0
   value as number = -1
   step base - value as number = 1
   is 1 an integral multiple of 2? no
   => suffering from a step mismatch

For the second case:

   step scale factor = 2
   allowed value step = 2 * 1 = 2
   step base = 0
   value as number = 5
   step base - value as number = -5
   is -5 an integral multiple of 2? no
   => suffering from a step mismatch

So yes, in both cases it's suffering from a step mismatch. The value's 
position with respect to min and max has no effect.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list