Closed Bug 158435 Opened 23 years ago Closed 23 years ago

Page Info's label-control association is broken (should be by id).

Categories

(SeaMonkey :: Page Info, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nick, Assigned: nick)

Details

(Keywords: html4, testcase)

Attachments

(2 files, 3 obsolete files)

According to the HTML spec, the "for" attribute in a label specifies the *id* of a form control, not the name (http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1). Check how the example in the spec uses both name and id attributes. But the code in pageInfo.js associate it by the name attribute.
Attached file testcase
Keywords: testcase
Attached patch patch (obsolete) — Splinter Review
Status: NEW → ASSIGNED
Comment on attachment 92081 [details] [diff] [review] patch sr=bzbarsky
Attachment #92081 - Flags: superreview+
Attached patch silly and harmless thing fixed (obsolete) — Splinter Review
Attachment #92081 - Attachment is obsolete: true
Attachment #92082 - Flags: superreview+
Attachment #92082 - Attachment is obsolete: true
Attachment #92083 - Flags: superreview+
Comment on attachment 92083 [details] [diff] [review] Ops, attached the old file instea of the new one =/ You are correct that the label really should match the id, and not the name. However, because mozilla also associates the for attribute with the names, this should also match with the names. The absolute easiest way to make this change is to add "|| formfields[j].id == whatfor" to the test inside the inner loop. I'd rather you didn't use .form anywhere, it has bugs, though I don't remeber the bug numbers right off. A couple of the comments in the code mention it though. I think .getAttribute("form") works correctly though, if you really need to do that.
>You are correct that the label really should match the id, and not the name. >However, because mozilla also associates the for attribute with the names. Where? If it does so, it's broken there. >I'd rather you didn't use .form anywhere, it has bugs, though I don't remeber >the bug numbers right off. A couple of the comments in the code mention it >though. I think .getAttribute("form") works correctly though, if you really >need to do that. Uhm... control.form is very widely used in pages, it gets the form object from a control. Being so idely used... why would be the bug that prevents its use here? Anyway it's an optimization, and it coud be removed...
Keywords: html4
AFAICS if I open the testcase and click on "Good label", the appropiate control get focused. If I click on "Bad label" it doesn't. It seems that Mozilla is getting right the label-form association and doesn't use name at all.
which test case?
er... the one attached to this bug, aptly named "testcase" =)
oh, that one. hrm, what does it do when you delete the doctype (putting it into quirks mode?) (I don't have Mozilla on this computer here at work)
I've tried with the page in quirks mode, same thing. Mozilla links the label to the form only by the id attribute, ignoring the link by "name".
Keywords: review
Comment on attachment 92083 [details] [diff] [review] Ops, attached the old file instea of the new one =/ r=ksosez
Attachment #92083 - Flags: review+
Comment on attachment 92083 [details] [diff] [review] Ops, attached the old file instea of the new one =/ Prevailing style clearly puts a space after if, for, and other keywords. Please follow it. /be
Attachment #92083 - Attachment is obsolete: true
Attachment #92120 - Flags: superreview+
Attachment #92120 - Flags: review+
Comment on attachment 92120 [details] [diff] [review] Some spaces added Approval granted for trunk checkin. Please request branch checkin once this is verified on trunk with no regressions.
Attachment #92120 - Flags: approval+
checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Approval for branch checkin; please change mozilla1.0.1+ to fixed1.0.1 when checked in.
Keywords: verified1.0.1
Verified on windows 2k, (netscape branch build: 2002-08-21-08-1.0)
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: