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;).
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.
IE 6 and Opera 8.01 on Windows also pass test. Bug 3715 is related (involves HTMLObjectElement) but is not a regression.
confirmed
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)
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?
Created attachment 2677 [details] Test of HTMLLabelElement.form outside of a form (expect null)
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.
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.
Comment on attachment 2691 [details] Update test case r=me