Open Bug 383457 Opened 17 years ago Updated 2 years ago

<button type="checkbox"> oncommand does not have checked state updated yet

Categories

(Core :: XUL, defect)

defect

Tracking

()

People

(Reporter: BenB, Unassigned)

Details

Attachments

(1 file)

Reproduction:
<checkbox id="A" type"checkbox" oncommand="text(e);" />
<button id="B" type"checkbox" oncommand="text(e);" />
<button id="C" type"checkbox" />
function test(e)
{
   dump(e.id + " is checked: " + e.hasAttribute("checked") + "\n");
}
document.getElementById("C").oncommand = test;

Actual result:
"A is checked: true" when you switch A from unpressed to pressed
"B is checked: false" when you switch B from unpressed to pressed
"C is checked: true" when you switch C from unpressed to pressed

Expected result:
All widgets/handlers behave the same. All reflect the new state, i.e. show "is checked: true" when going from unpressed to pressed and "is checked: false" when going from pressed to unpressed.

Cause:
Probably, the implementation of <button type="checkbox"> has oncommand handler itself which sets the checked/not checked state, and the widget's oncommand handler competes with the caller's oncommand handler on execution order. This does not happen for <checkbox>.
The same seems to be the case for <toolbarbutton> in firefox 2.0.0.4, while it works in seamonkey 1.1.3
Assignee: jag → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: