[whatwg] Option label, textContent and value
ian at hixie.ch
Tue Jun 14 01:27:34 PDT 2011
On Tue, 14 Jun 2011, Jonas Sicking wrote:
> On Tue, Jun 14, 2011 at 12:11 AM, Ian Hickson <ian at hixie.ch> wrote:
> >> Furthermore, as I understand the above definitions, the spec does allow
> >> to specify label and value in one step in a select element:
> >> <select>
> >> <option>This is value and label
> >> </select>
> >> But not in a datalist, as the label is taken from the textContent rather
> >> than from the value of the option element:
> >> <datalist>
> >> <option value="No label here">
> >> <option label="No value here">
> >> </datalist>
> > The difference is that the value is typically shown in the datalist case.
> At least <input type=email> seems like a very common example where
> you'd want to show a label. Here you likely will want to show peoples
> names, but choosing a name would use the email address as the .value
> for the <input>.
Absolutely. My point is just that if the label is missing (no name) you'd
still show the value, unlike in <select>, where historically UAs never
show the value of the value="" attribute. In fact you'd likely show the
value in both cases, as in some of the sample UI images shown in the spec
(where the value is on the left, autocompleting, and the label is on the
right where available).
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg