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

NEW
Unassigned

Status

()

Core
XUL
11 years ago
4 years ago

People

(Reporter: BenB, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
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>.
(Reporter)

Comment 1

11 years ago
Created attachment 267450 [details]
Another testcase, from Martijn Gerrits

Comment 2

11 years ago
The same seems to be the case for <toolbarbutton> in firefox 2.0.0.4, while it works in seamonkey 1.1.3

Updated

10 years ago
Assignee: jag → nobody
You need to log in before you can comment on or make changes to this bug.