[whatwg] Forms-related feedback

Jonas Sicking jonas at sicking.cc
Mon Jan 14 17:34:31 PST 2013


On Jan 8, 2013 1:47 AM, "Ian Hickson" <ian at hixie.ch> wrote:
> > >> > [1] The only difference between Chrome's spin buttons behaviour
and our
> > >> > proposal is that when value is the empty string, it is setting
value to
> > >> > 0 and continue to the next steps (unless the 0 is below the minimal
> > >> > allowed value and n < 0, in that case value=min). It might be
> > >> > interesting to specify something better than "do nothing" if
value="".
> > >
> > > I'm open to doing that too; what would you preference be?
> >
> > Maybe if value isn't valid, we could have it changed to the step base or
> > |min + (max - min)/2| and exit the steps if stepDown() or stepUp() is
> > called. (I think even if stepDown(hugeNumber) is called, we should still
> > just set the value and do nothing else.) I would tend to prefer step
> > base mostly because it would know set it to the default value if there
> > is a default value. However, I think step base is quite a bad solution
> > for some types. Maybe we could use the "default value" if there is such
> > a concept for the type or the "step base" otherwise?
>
> It's probably simple enough for authors to check valueAsNumber is not NaN
> and then have them set it to the value they want as the default, if
> they're calling the stepUp/stepDown methods. I've left this as throwing if
> the value isn't a number.

*All* behavior of stepUp/stepDown is easy enough for authors to work around
to cover cases where they don't agree with the spec.

But if they have to, I don't see why they wouldn't simply not use
stepUp/stepDown and implement whatever functionality that they want.

The functionality that these functions provide is very little. So if they
don't solve the authors use case exactly I think its easier for them in
almost all cases to simply write their own implementation. Especially if
you take into account the time and effort involved in looking up how the
function works.

So if we are going to have these functions at all, I think it should be
possible to simply make the implementation of a button as simple as:

<button onclick="elem.stepUp()">...
<button onclick="elem.stepDown()">...

And that this should in all cases produce good UI in as many cases as
possible, and should never throw any exceptions.

If we can't fulfill those use cases and requirement, then I think we might
as well remove these functions.

/ Jonas



More information about the whatwg mailing list