RESOLVED FIXED 148863
A label element not in a document should not label an element in a document
https://bugs.webkit.org/show_bug.cgi?id=148863
Summary A label element not in a document should not label an element in a document
Ryosuke Niwa
Reported 2015-09-04 18:18:34 PDT
See https://html.spec.whatwg.org/multipage/forms.html#the-label-element "The for attribute may be specified to indicate a form control with which the caption is to be associated. If the attribute is specified, the attribute's value must be the ID of a labelable element in the same Document as the label element. If the attribute is specified and there is an element in the Document whose ID is equal to the value of the for attribute, and the first such element is a labelable element, then that element is the label element's labeled control." When a label element is not in the document, it should not be associated with any form control element. This bug was found by the newly added test: LayoutTests/http/tests/w3c/html/semantics/forms/the-label-element/label-attributes.html
Attachments
Patch (4.32 KB, patch)
2015-10-22 14:06 PDT, Chris Dumez
no flags
Patch (5.08 KB, patch)
2015-10-23 09:59 PDT, Chris Dumez
no flags
Radar WebKit Bug Importer
Comment 1 2015-09-04 18:19:15 PDT
Chris Dumez
Comment 2 2015-10-22 14:06:12 PDT
Ryosuke Niwa
Comment 3 2015-10-22 21:48:26 PDT
Comment on attachment 263860 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=263860&action=review > Source/WebCore/html/HTMLLabelElement.cpp:81 > // Find the first element whose id is controlId. If it is found and it is a labelable form control, > - // return it, otherwise return 0. > + // return it, otherwise return nullptr. This is a very wordy comment. Why don't we just remove this comment and rename nodeAsSupportedLabelableElement to firstLabelableFormControl?
Chris Dumez
Comment 4 2015-10-23 09:59:57 PDT
WebKit Commit Bot
Comment 5 2015-10-23 10:48:32 PDT
Comment on attachment 263931 [details] Patch Clearing flags on attachment: 263931 Committed r191497: <http://trac.webkit.org/changeset/191497>
WebKit Commit Bot
Comment 6 2015-10-23 10:48:37 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.