WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
80499
[Forms] label.form attribute doesn't work
https://bugs.webkit.org/show_bug.cgi?id=80499
Summary
[Forms] label.form attribute doesn't work
yosin
Reported
2012-03-07 00:12:25 PST
According to the standard[1], the "label" element has "form" attribute in IDL. However, in sample URI(
http://jsfiddle.net/gDcAG/3/
), JS expression label1.form returns null instead of HTMLFormElement object, even if HTMLLabelElement.idl[2] has "form" attribute. "form" attribute is implemented in HTMLElement.h[3] as virtualForm/findFormAncestor in HTMLElement.cpp[4]. In this implementation, "label" elements outside "form" elements don't work as expected. == References == [1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-label-element
[2]
http://trac.webkit.org/browser/trunk/Source/WebCore/html/HTMLLabelElement.idl
[3]
http://trac.webkit.org/browser/trunk/Source/WebCore/html/HTMLElement.h
[4]
http://trac.webkit.org/browser/trunk/Source/WebCore/html/HTMLElement.cpp
Attachments
Patch 1
(6.71 KB, patch)
2012-03-14 00:35 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 2
(20.51 KB, patch)
2012-03-14 03:11 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 3
(19.91 KB, patch)
2012-03-15 20:57 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 4
(19.87 KB, patch)
2012-03-15 23:23 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
yosin
Comment 1
2012-03-14 00:35:32 PDT
Created
attachment 131799
[details]
Patch 1
Kent Tamura
Comment 2
2012-03-14 01:18:19 PDT
Comment on
attachment 131799
[details]
Patch 1 View in context:
https://bugs.webkit.org/attachment.cgi?id=131799&action=review
> Source/WebCore/html/HTMLLabelElement.cpp:88 > +{
The code is very similar to FormAssociated::insertedIntoTree() and FormAssociated::resetFormOwner(). Please share the code.
> LayoutTests/fast/forms/form-attribute-expected.txt:NaN > PASS document.getElementsByTagName("button")[0].form is owner
Please remove FIXME in this file.
> LayoutTests/fast/forms/label/label-form-attribute.html:1 > +<DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
As you know, we already have some tests for 'form' attribute. I recommend add test cases for 'label' to form-attribute.html and form-attribute-nonexistence-form-id.html, and remove this file.
> LayoutTests/fast/forms/label/label-form-attribute.html:12 > +var html = '<dvi id=outer>';
typo: <dvi>
yosin
Comment 3
2012-03-14 03:11:35 PDT
Created
attachment 131817
[details]
Patch 2
Kent Tamura
Comment 4
2012-03-15 17:49:16 PDT
Comment on
attachment 131817
[details]
Patch 2 View in context:
https://bugs.webkit.org/attachment.cgi?id=131817&action=review
Please rebase the patch.
http://trac.webkit.org/changeset/110918
conflicts with this.
> Source/WebCore/html/FormAssociatedElement.cpp:100 > + HTMLElement* element = toHTMLElement(this); > + setForm(findAssociatedForm(element, m_form));
The variable "element" is not needed. setForm(findAssociatedForm(toHTMLElement(this), m_form));
> Source/WebCore/html/FormAssociatedElement.cpp:155 > + setForm(findAssociatedForm(element, m_form));
ditto.
yosin
Comment 5
2012-03-15 20:57:25 PDT
Created
attachment 132187
[details]
Patch 3
Kent Tamura
Comment 6
2012-03-15 21:00:52 PDT
Comment on
attachment 132187
[details]
Patch 3 View in context:
https://bugs.webkit.org/attachment.cgi?id=132187&action=review
> Source/WebCore/html/HTMLLabelElement.cpp:33 > +#include "HTMLFormControlElement.h" > +#include "HTMLFormElement.h"
Do we need to include HTMLFormControlElement.h and HTMLFormElement.h?
yosin
Comment 7
2012-03-15 23:23:55 PDT
Created
attachment 132210
[details]
Patch 4
yosin
Comment 8
2012-03-15 23:24:35 PDT
(In reply to
comment #6
)
> (From update of
attachment 132187
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=132187&action=review
> > > Source/WebCore/html/HTMLLabelElement.cpp:33 > > +#include "HTMLFormControlElement.h" > > +#include "HTMLFormElement.h" > > Do we need to include HTMLFormControlElement.h and HTMLFormElement.h?
Removed. Thanks for catching this!
Kent Tamura
Comment 9
2012-03-15 23:46:48 PDT
Comment on
attachment 132210
[details]
Patch 4 ok
WebKit Review Bot
Comment 10
2012-03-16 06:05:52 PDT
Comment on
attachment 132210
[details]
Patch 4 Clearing flags on attachment: 132210 Committed
r110996
: <
http://trac.webkit.org/changeset/110996
>
WebKit Review Bot
Comment 11
2012-03-16 06:05:57 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.
Top of Page
Format For Printing
XML
Clone This Bug