[whatwg] Allow empty string for input type=color

I apologize in case this has been discussed before - the list archive 
search seems to be broken right now, as it does not find any matches 
when searching for "color".

I just noticed a note in the spec of input type=color 
http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#color-state-%28type=color%29:

"Note: In this state, there is always a color picked, and there is no 
way to set the value to the empty string."

If I understand the spec correctly, entering no value defaults to 
#000000, thus the required attribute does not apply. What are the 
reasons for this? I am sure there were good reasons to specify it this 
way, anyway I don't see them right now. "Not selected" is actually very 
different from "black".

I see the following reasons for allowing the empty string:

1. An application might want to give the user the choice of not 
selecting a color. Not specifying a color is the easiest way to state 
that the default color should be used, be it black or other.

2. An application might want to force the user to make an explicit 
selection. It may not be able to distinguish whether "black" was 
explicitly selected, or the user forgot to specify a color.

3. Applications need to deal with the empty string anyway, as legacy 
browsers show a text field.

Received on Thursday, 3 May 2012 02:10:11 UTC