Re: The label element may contain at most one input, button, select, textarea, or keygen descendant.

2013-10-01 10:36, Felix E. Klee wrote:

> That's what the validator says for:

You mean that the validator says "The label element may contain at most 
one input, button, select,  textarea, or keygen descendant." (In future, 
please make e-mail message content self-contained, without implying the 
Subject line.)

> However, the HTML5 W3C Candidate Recommendation 6 August 2013
> [suggests][1] that multiple input ("labelable") elements are OK:
>
>> If the for attribute is not specified, but the label element has a
>> labelable element descendant, then the first such descendant in tree
>> order is the label element's labeled control.

It does not say they are OK. It just defines what happens if they are 
used. This is an error processing rule, since the definition of the 
element says (under "Content model") that the content shall be "Phrasing 
content, but with no descendant labelable elements unless it is the 
element's labeled control, and no descendant label elements."

Perhaps the formulation could be better, but the intended meaning is 
that the content may contain at most one labelable element.

The construct

         <label>
           <input type="radio" />
           <input type="text" />
         </label>

would be rather odd, in addition to being invalid; the error processing 
rule means that the radio button is the labeled control and the text 
input control is its label!

Yucca

Received on Tuesday, 1 October 2013 07:56:10 UTC