Closed Bug 590353 Opened 15 years ago Closed 15 years ago

Do not try to reset the default value if the element value isn't different from the value attribute

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: mounir, Assigned: mounir)

References

Details

(Keywords: regression)

Attachments

(2 files)

Attached file Test case
If during an onclick handler, the value of a checkbox (very likely a radio too) is changed, the checkbox will not be checked. The reason seems to be because we go to ::SetValueInternal and then, because it's not a text control, we call ::SetAttr (then ::AfterSetAttr). And, because the dirty value flag is false, the value is reseted to the default value. An easy fix would be to not reset the element to the default value if the checkedness flag is true but that would probably cause some minor differences with the current specifications. Attached, a test case. When clicking on the checkbox, the expected behavior is to see "value: 0 checked: true" in the textarea (Firefox 3.6 does that). With Firefox 4 b4, it's "value: 0 checked: false".
blocking2.0: --- → ?
Blocking and cc:ing Bret who found this bug! :)
Assignee: nobody → mounir.lamouri
blocking2.0: ? → betaN+
My girlfriend Lindsay found this bug, I was merely the messenger.
Another test case has been written by Boris on bug 592228: https://bugzilla.mozilla.org/attachment.cgi?id=470761
Summary: Changing the value of a checkbox during onclick happens to be a no op → Do not try to reset the default value if the element value isn't different from the value attribute
Attached patch Patch v1Splinter Review
Attachment #471724 - Flags: review?(Olli.Pettay)
Status: NEW → ASSIGNED
Comment on attachment 471724 [details] [diff] [review] Patch v1 Ok, r+, although this code is getting harder and harder to understand.
Attachment #471724 - Flags: review?(Olli.Pettay) → review+
Thank you Bret and Lindsay for reporting this bug. This will be fixed in Firefox 4 beta 6. Push: http://hg.mozilla.org/mozilla-central/rev/89977f3a769c
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: