<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>22994</bug_id>
          
          <creation_ts>2013-08-17 05:27:37 +0000</creation_ts>
          <short_desc>Clarify option element&apos;s label must be a non empty string.</short_desc>
          <delta_ts>2013-09-12 21:29:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>NEEDSINFO</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Takeshi Kurosawa">taken.spc</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>92219</commentid>
    <comment_count>0</comment_count>
    <who name="Takeshi Kurosawa">taken.spc</who>
    <bug_when>2013-08-17 05:27:37 +0000</bug_when>
    <thetext>I propose clarifying option element&apos;s label must be a non empty string.

# Background
Please see
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-August/040406.html

In one of datalist element example, option elements have value content attribute and don&apos;t have label content attribute.
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element

&lt;label&gt;
 Sex:
 &lt;input name=sex list=sexes&gt;
 &lt;datalist id=sexes&gt;
  &lt;option value=&quot;Female&quot;&gt;
  &lt;option value=&quot;Male&quot;&gt;
 &lt;/datalist&gt;
&lt;/label&gt;

In this case, labels are calculated from option elements&apos; content (text nodes) and are whitespace only string. As current spec doesn&apos;t say &quot;label must contain characters other than whitespace&quot;, this example is valid (conforming).

However following is invalid as per current spec.
Because option elements don&apos;t have any child nodes.

&lt;label&gt;
 Sex:
 &lt;input name=sex list=sexes
 &gt;&lt;datalist id=sexes
  &gt;&lt;option value=&quot;Female&quot;
  &gt;&lt;option value=&quot;Male&quot;
 &gt;&lt;/datalist
&gt;&lt;/label&gt;

That is non-intuitive.

## Proposal

1. Clarify label of option element must be a string that isn&apos;t the empty string

Change the sentence

&gt; 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#concept-option-label

to something like

&gt; The label content attribute, if specified, must not be empty. If the attribute is not specified, then the element&apos;s text IDL attribute must not be empty


2. Clarify option element which is descendant of datalist element, that has both non empty label and value represents a suggestion.

Change the sentence

&gt; Each option element that is a descendant of the datalist element, that is not disabled, and whose value is a string that isn&apos;t the empty string, represents a suggestion.
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element

to something like

&gt; Each option element that is a descendant of the datalist element, that is not disabled, and whose value and label are string that isn&apos;t the empty string, represents a suggestion.


3. Modify datalist example to match 1. and 2.

Change

&lt;label&gt;
 Sex:
 &lt;input name=sex list=sexes&gt;
 &lt;datalist id=sexes&gt;
  &lt;option value=&quot;Female&quot;&gt;
  &lt;option value=&quot;Male&quot;&gt;
 &lt;/datalist&gt;
&lt;/label&gt;
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element

to

&lt;label&gt;
 Sex:
 &lt;input name=sex list=sexes&gt;
 &lt;datalist id=sexes&gt;
  &lt;option&gt;Female
  &lt;option&gt;Male
 &lt;/datalist&gt;
&lt;/label&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92366</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-08-20 17:58:09 +0000</bug_when>
    <thetext>I changed this recently for unrelated reasons:

   http://html5.org/tools/web-apps-tracker?from=8146&amp;to=8147

Does that address your concerns satisfactorily?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92393</commentid>
    <comment_count>2</comment_count>
    <who name="Takeshi Kurosawa">taken.spc</who>
    <bug_when>2013-08-20 23:46:43 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I changed this recently for unrelated reasons:
&gt; 
&gt;    http://html5.org/tools/web-apps-tracker?from=8146&amp;to=8147
&gt; 
&gt; Does that address your concerns satisfactorily?

Thanks. It does.

I noticed proposed example ma cause backward compatibility issue (Female and Male will be rendered on old browsers). So I would like to change proposed example to use label and value attributes.

&gt; &lt;label&gt;
&gt;  Sex:.
&gt;  &lt;input name=sex list=sexes&gt;
&gt;  &lt;datalist id=sexes&gt;
&gt;   &lt;option&gt;Female
&gt;   &lt;option&gt;Male
&gt;  &lt;/datalist&gt;
&gt; &lt;/label&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92478</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-08-22 20:28:07 +0000</bug_when>
    <thetext>Which spec are you looking at? I don&apos;t see that markup in the HTML standard. Can you provide a URL to the problem?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>