Bug 3714

Summary: REGRESSION: HTMLLabelElement.form returns null
Product: WebKit Reporter: Curt Arnold <curt.arnold>
Component: DOMAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 412   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Web page and associated scripts
none
Traverse parent nodes looking for a form element
darin: review-
Test of HTMLLabelElement.form outside of a form (expect null)
none
Update test case darin: review+

Curt Arnold
Reported 2005-06-25 15:23:16 PDT
The attached tarball contains a production of the HTMLLabelElement01 test case from the DOM L2 Test suite. The test passes on Safari build 412 and Firefox but will fail on the current WebKit CVS HEAD due to the CVS HEAD returning null on the call to HTMLLabelElement.form in HTMLLabelElement01.js (fNode = testNode.form;).
Attachments
Web page and associated scripts (5.51 KB, application/octet-stream)
2005-06-25 15:24 PDT, Curt Arnold
no flags
Traverse parent nodes looking for a form element (2.36 KB, patch)
2005-06-27 12:31 PDT, Anders Carlsson
darin: review-
Test of HTMLLabelElement.form outside of a form (expect null) (5.49 KB, application/octet-stream)
2005-06-27 16:57 PDT, Curt Arnold
no flags
Update test case (2.66 KB, patch)
2005-06-28 14:46 PDT, Anders Carlsson
darin: review+
Curt Arnold
Comment 1 2005-06-25 15:24:46 PDT
Created attachment 2646 [details] Web page and associated scripts Open HTMLLabelElement01.html in Safari. Will display green success message in stock Safari and Firefox, red error with CVS HEAD.
Curt Arnold
Comment 2 2005-06-25 16:27:14 PDT
IE 6 and Opera 8.01 on Windows also pass test. Bug 3715 is related (involves HTMLObjectElement) but is not a regression.
Joost de Valk (AlthA)
Comment 3 2005-06-26 12:30:55 PDT
confirmed
Anders Carlsson
Comment 4 2005-06-27 12:31:36 PDT
Created attachment 2674 [details] Traverse parent nodes looking for a form element Turns out that the form() method was buggy. Also, it tried to get the form of the element set as "for", which is broken (Neither Gecko nor WinIE does this)
Darin Adler
Comment 5 2005-06-27 16:35:35 PDT
Comment on attachment 2674 [details] Traverse parent nodes looking for a form element A few comments: 1) The old version of HTMLLabelElementImpl::form has a bug -- it's calling isGenericFormElement() on this rather than on element. That's fine if we are rewriting it, but worth noting. 2) The loop looking for a ID_FORM in parents is the same as the existing getForm() function; we should not write a new copy of that function. (Although perhaps we should rename it.) 3) I don't think this is significantly different from the form function in the base class. Can we just remove the override of the base form class's form function? Do we have a test for the case where the <label> element is outside the form and the form element it points to is inside? What about when the <label> is in one form, and the form element is in another?
Curt Arnold
Comment 6 2005-06-27 16:57:25 PDT
Created attachment 2677 [details] Test of HTMLLabelElement.form outside of a form (expect null)
Curt Arnold
Comment 7 2005-06-27 16:58:01 PDT
There only appear to be two tests in the DOM L2 HTML test suite that address HTMLLabelElement.form: HTMLLabelElement01 and HTMLLabelElement02. Both load the same document, but test different elements. HTMLLabelElement02 checks that a label outside the range of a form returns null for HTMLLabelElement.form. I've attached HTMLLabelElement02 as an attachment to the bug report, though it passed in the original implementation. I'm not sure if I understand the third case you are suggesting. The DOM TS distributions contain reports that break down tests by name, functions tested, etc. If you download the suite, open dom2-html-matrix.html in a browser. Hopefully pretty explanatory. Unfortunately due to a strange nature of the L2 HTML suite, the links to the XML test definitions are broken except for tests that are not shared with the L1 HTML suite, but the links to the Java rendering should still be good.
Anders Carlsson
Comment 8 2005-06-28 14:46:40 PDT
Created attachment 2691 [details] Update test case Note that HTMLLabelElementImpl doesn't inherit from HTMLGenericFormElementImpl, so we can't use its form() method. I've updated the test case with a label outside a form but its for element inside a form.
Darin Adler
Comment 9 2005-06-29 08:14:54 PDT
Comment on attachment 2691 [details] Update test case r=me
Note You need to log in before you can comment on or make changes to this bug.