<?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>24801</bug_id>
          
          <creation_ts>2014-02-25 15:04:56 +0000</creation_ts>
          <short_desc>&lt;option&gt; content model</short_desc>
          <delta_ts>2014-02-26 21:47:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML Checker</product>
          <component>General</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrea Rendine">master.skywalker.88</reporter>
          <assigned_to name="Michael[tm] Smith">mike+validator</assigned_to>
          <cc>master.skywalker.88</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="qa-dev tracking">www-validator-cvs</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>101334</commentid>
    <comment_count>0</comment_count>
    <who name="Andrea Rendine">master.skywalker.88</who>
    <bug_when>2014-02-25 15:04:56 +0000</bug_when>
    <thetext>Just tried to validate a document with a &lt;option&gt; element.
The syntax for the specific fragment was as follows:

      &lt;select&gt;
       &lt;option label=&quot;Opel&quot; value=&quot;opel&quot;&gt;&lt;/option&gt;
       &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; /&gt;
      &lt;/select&gt;

The second option (Audi) has a label and a value, so according to the specs it admits an empty content model as well as end tag omission. I use the XHTML syntax which is allowed in HTML (though it has no effect).

The response from the validator is error. More precisely
Self-closing syntax (/&gt;) used on a non-void HTML element. Ignoring the slash and treating as a start tag.

Which is somehow confusing, as in this structure the option element is effectively treated as void (it cannot have both label+value and content). 
In fact when validating the same document as XHTML, the validator flags nothing. If the problem is in using the self-closing syntax in a non-void element, then the element is non-void as both HTML and XHTML (the validation for the latter does not take into account only well-formedness) and XHTML validation must report it accordingly.
If, on the contrary, there&apos;s a bug in the validator not recognizing the void element, then it&apos;s HTML validator which must be corrected. It&apos;s the same issue as &quot;&lt;menuitem&gt; content model&quot; that I sent some weeks ago (still unresponded).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101450</commentid>
    <comment_count>1</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2014-02-26 20:44:33 +0000</bug_when>
    <thetext>(In reply to Andrea Rendine from comment #0)
&gt;        &lt;option label=&quot;Opel&quot; value=&quot;opel&quot;&gt;&lt;/option&gt;
&gt;        &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; /&gt;
...
&gt; The response from the validator is error. More precisely
&gt; Self-closing syntax (/&gt;) used on a non-void HTML element. Ignoring the slash
&gt; and treating as a start tag.

Yeah, conforms to the spec.

...
&gt; In fact when validating the same document as XHTML, the validator flags
&gt; nothing.

Right. That&apos;s because in XML, &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; /&gt; is exactly the same thing as &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; &gt;&lt;/option&gt; -- because in XML there is actually something called a &quot;self-closing&quot; tag.

But in text/html, &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; /&gt; is not the same thing as &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; &gt;&lt;/option&gt; at all -- because in text/html there is no such thing as a &quot;self-closing&quot; tag.

In other words, in text/html that slash in the start tag has no meaning at all and no effect at all.

&gt; If the problem is in using the self-closing syntax in a non-void
&gt; element,

No, because there&apos;s no such thing as &quot;self-closing syntax&quot; in text/html. The slash is irrelevant. The only problem is that the &lt;option&gt; element is not a void element, and per the spec in text/html it must have an end tag. But it does not have an end tag in your document. Hence the error.

&gt; then the element is non-void as both HTML and XHTML

There is no such thing as a void element in XML. The term &quot;void element&quot; is something specific to text/html&gt;

&gt; (the validation
&gt; for the latter does not take into account only well-formedness) and XHTML
&gt; validation must report it accordingly.

No it must not, because there&apos;s no error to report. To an XML parser, &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; /&gt; is exactly the same thing as &lt;option label=&quot;Audi&quot; value=&quot;audi&quot; &gt;&lt;/option&gt;.

&gt; If, on the contrary, there&apos;s a bug in the validator not recognizing the void
&gt; element, then it&apos;s HTML validator which must be corrected.

There&apos;s no bug in the validator for this case. The validator behavior here conforms to the spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101454</commentid>
    <comment_count>2</comment_count>
    <who name="Andrea Rendine">master.skywalker.88</who>
    <bug_when>2014-02-26 21:06:15 +0000</bug_when>
    <thetext>My fault was not to see in detail the difference between W3 HTML5 spec and WHATWG HTML Living Standard. In the latter it is stated that the &lt;option&gt; end tag is omissible in HTML under certain conditions. This, and the fact that the element&apos;s content model with both @label and @value specified is *empty*, induced me to think that a syntax like &lt;select&gt;&lt;option label=&quot;foo&quot; value=&quot;bar&quot;&gt;&lt;/select&gt; were allowed in HTML. Hence a polyglot syntax like the one in my example (I meant &quot;void element in HTML representing an element without content in XHTML&quot;).
Now I know that end tag omission is non-standard for &lt;option&gt; and I&apos;ll set the &lt;option&gt;&lt;/option&gt; structure as polyglot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101465</commentid>
    <comment_count>3</comment_count>
    <who name="Andrea Rendine">master.skywalker.88</who>
    <bug_when>2014-02-26 21:37:52 +0000</bug_when>
    <thetext>Anyway, could I suggest something? In some elements the section &quot;tag omission in text/HTML&quot; is explicitly specified. In some elements it isn&apos;t. This is a problem in such cases - had I known that W3 HTML5 spec differs from the living standard in that it expects &quot;Neither tag is omissible&quot;. This way it would be an author&apos;s fault to have it omitted.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101466</commentid>
    <comment_count>4</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2014-02-26 21:39:29 +0000</bug_when>
    <thetext>(In reply to Andrea Rendine from comment #3)
&gt; Anyway, could I suggest something? In some elements the section &quot;tag
&gt; omission in text/HTML&quot; is explicitly specified. In some elements it isn&apos;t.
&gt; This is a problem in such cases - had I known that W3 HTML5 spec differs
&gt; from the living standard in that it expects &quot;Neither tag is omissible&quot;. This
&gt; way it would be an author&apos;s fault to have it omitted.

Are you asking for a spec change? Or what? As far as I can see there&apos;s nothing I can change in the validator in relation to this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101469</commentid>
    <comment_count>5</comment_count>
    <who name="Andrea Rendine">master.skywalker.88</who>
    <bug_when>2014-02-26 21:47:49 +0000</bug_when>
    <thetext>In fact there&apos;s nothing for the validator. Sorry, I&apos;ll refer to the spec for a suggestion.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>