This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15101 - Multiple input buttons inside a label
Summary: Multiple input buttons inside a label
Status: RESOLVED INVALID
Alias: None
Product: Validator
Classification: Unclassified
Component: check (show other bugs)
Version: HEAD
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-07 16:30 UTC by zwwwz
Modified: 2011-12-14 19:55 UTC (History)
1 user (show)

See Also:


Attachments

Description zwwwz 2011-12-07 16:30:40 UTC
Per http://www.w3.org/TR/html/dtds.html
# The label element may contain at most one descendant input element, button element, select element, or textarea element.

This is not caught when validating local html.
I was trying to troubleshoot a possible jQuery problem when I stumbled upon this:
http://jsfiddle.net/dDJCS/

Validated local source: This document was successfully checked as XHTML 1.0 Transitional!
Comment 1 Ville Skyttä 2011-12-07 18:23:53 UTC
(In reply to comment #0)
> Per http://www.w3.org/TR/html/dtds.html
> # The label element may contain at most one descendant input element, button
> element, select element, or textarea element.

I don't see that text in the cited document.  It does say "Each label must not contain more than ONE field", but that's just a comment in the DTD and not specified in a form that could be used when validating a document against the DTD.  http://validator.w3.org/docs/help.html#validation_basics
Comment 2 zwwwz 2011-12-08 00:18:02 UTC
http://dev.w3.org/html5/markup/label.html
# The label element may contain at most one descendant input element, button
element, select element, or textarea element. 

same concept applies to xhtml but isn't being enforced in the validator
Comment 3 Ville Skyttä 2011-12-08 17:50:06 UTC
HTML5 validation rules are very different from XHTML or HTML < 5 validation.

For HTML5 the issue is caught:

<!DOCTYPE html>
<html>
<head><title></title>
    <label>
        <input type="button" class="setNamePattern" value="1111">
        <input type="button" class="setNamePattern" value="2222">
    </label>
</html>

Line 6, Column 65: The label element may contain at most one input, button, select, textarea, or keygen descendant.
Line 4, Column 11: label element with multiple labelable descendants.
Comment 4 zwwwz 2011-12-11 23:51:04 UTC
(In reply to comment #3)
> HTML5 validation rules are very different from XHTML or HTML < 5 validation.
> 
> For HTML5 the issue is caught:
> 
> <!DOCTYPE html>
> <html>
> <head><title></title>
>     <label>
>         <input type="button" class="setNamePattern" value="1111">
>         <input type="button" class="setNamePattern" value="2222">
>     </label>
> </html>
> 
> Line 6, Column 65: The label element may contain at most one input, button,
> select, textarea, or keygen descendant.
> Line 4, Column 11: label element with multiple labelable descendants.

so are you saying that I should be able to put multiple buttons in a label?
Comment 5 Ville Skyttä 2011-12-12 06:06:49 UTC
No, comments 1 and 3 are what I'm saying.
Comment 6 zwwwz 2011-12-14 19:55:38 UTC
(In reply to comment #5)
> No, comments 1 and 3 are what I'm saying.

If you check out the jsfiddle example you see that jquery does not work correctly. I filed a bug with jquery, they said that this is just invalid html and told me to file a bug with w3c since you guys say it is valid.