[whatwg] Input color state: type mismatch

Aryeh Gregor Simetrical+w3c at gmail.com
Mon Mar 29 12:49:32 PDT 2010


On Sat, Mar 27, 2010 at 9:48 AM, Mounir Lamouri
<mounir.lamouri at gmail.com> wrote:
> It looks like the input color state can't suffer from type mismatch
> according to the specs but it seems to be the only way to be sure the
> value is correct. Email and URL states can suffer from type mismatch for
> the exact same reason.

It isn't possible for color inputs to suffer from a type mismatch,
because the spec says "User agents must not allow the user to set the
value to a string that is not a valid lowercase simple color."  If the
user somehow selects an invalid color, the UA is required to simply
refuse it, or auto-correct it somehow.  This doesn't work well with a
text input, where the user has to type the color incrementally -- I
guess the UA could decide to not update the script-visible/submitted
value until the user no longer focuses the form field, and if the
value isn't valid at that time, it could revert to the previous value.



More information about the whatwg mailing list