[whatwg] datalist element example and option element content model

Kurosawa Takeshi taken.spc at gmail.com
Fri Aug 16 22:32:41 PDT 2013

Hi, Mike

Thank you for your detailed comment.
I figure out why the example is valid per current spec.

> If you think the spec should say that, you should probably file a spec bug.

I think it should, so I filed a bug.

Bug 22994 - Clarify option element's label must be a non empty string.


On Thu, Aug 8, 2013 at 3:34 AM, Michael[tm] Smith <mike at w3.org> wrote:
> Kurosawa Takeshi <taken.spc at gmail.com>, 2013-07-18 09:24 +0900:
>> I noticed inconsistency between datalist element example and option
>> element content model.
>> In a datalist element's code example, there are option elements which
>> don't specify label attribute and are empty.
>> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element
>> > <label>
>> >  Sex:
>> >  <input name=sex list=sexes>
>> >  <datalist id=sexes>
>> >   <option value="Female">
>> >   <option value="Male">
>> >  </datalist>
>> > </label>>
> Those option elements aren't empty. They contain text nodes. Those text
> nodes are just whitespace but for them to be completely empty, the markup
> would instead need to be something like:
>   <datalist id=sexes>
>    <option value="Female"><option value="Male"></datalist>
> ..Which would then actually be invalid per the spec.
>> However option element section prohibits such condition.
> The current spec doesn't prohibit the example you gave above. The spec
> just says, "the element itself must not be empty". But those option
> elements aren't empty, so as far as the spec goes, they're conforming.
>> > The label content attribute, if specified, must not be empty. If the attribute is not specified, then the element itself must not be empty.
>> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-option-element
>> My question is which one is correct: the code example or the option
>> element section.
> They're both correct.
> It may be that what we want the spec to say here instead is that the text
> content of label-less option element must contain characters other than
> whitespace. But that's not what the spec says now.
> If you think the spec should say that, you should probably file a spec bug.
>   --Mike
> --
> Michael[tm] Smith http://people.w3.org/mike

Takeshi Kurosawa <taken.spc at gmail.com>

More information about the whatwg mailing list