W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

Re: [whatwg] datalist element example and option element content model

From: Michael[tm] Smith <mike@w3.org>
Date: Thu, 8 Aug 2013 03:34:26 +0900
To: Kurosawa Takeshi <taken.spc@gmail.com>
Message-ID: <20130807183426.GA91187@sideshowbarker>
Cc: whatwg@whatwg.org
Kurosawa Takeshi <taken.spc@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.


Michael[tm] Smith http://people.w3.org/mike
Received on Wednesday, 7 August 2013 18:35:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC