Closed
Bug 43993
Opened 26 years ago
Closed 26 years ago
onClick event fires too early
Categories
(Core :: Layout: Form Controls, defect, P3)
Tracking
()
People
(Reporter: mpercy, Assigned: rods)
Details
In M16, if you write something like:
<INPUT TYPE="checkbox" onClick="alert(this.checked);">
it returns the opposite result that it should - the state it was in BEFORE the
action was performed. The correct behavior, returning the state it is in AFTER
the action is performed, can be demonstrated by trying this same snippet in
Navigator 4 or MSIE 4/5 (older browsers untested).
| Reporter | ||
Comment 2•26 years ago
|
||
No, this is almost the opposite, but seems a bit more complicated than that.
From observation I have gleaned that the message is most likely sent as soon as
you MouseDown, but there is no reaction until MouseUp.
Possibly onClick is an onMouseDown hack that waits until onMouseUp to react?
Couldnt tell you, but this is the behavior I am seeing. It should wait until
after MouseUp to read the state of the element. This has nothing to do with
onBlur.
I'm having to agree with Michael's observation of how Mozilla is parsing onClick
(). Confirming bug. This behavior is exhibited even if it is the only line in
an HTML file. (As I had expected.)
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 4•26 years ago
|
||
This sounds like a duplicate of my bug 42972 that I have a fix for. So please
verify, and if so, dup it. Thanks
| Reporter | ||
Comment 5•26 years ago
|
||
This describes the same behavior as bug 42972 but what we are seeing is not
limited only to checkboxes, which is as far as bug 42972 takes it. This also
applies to radio buttons, and although it would be difficult to demonstrate, I
suspect it applies to all kinds of form elements. I would even venture to say
that the real "bug" is in the current implementation of onClick itself.
| Reporter | ||
Comment 6•26 years ago
|
||
Hmm, scratch that... I don't know how far reaching it is after all. The bug
*does* affect radio buttons. However, the following snippet demonstrates the
correct behavior:
<select onClick="alert(this.selectedIndex);">
<option>EL 0</option>
<option>EL 1</option>
</select>
So apparently the bug does not affect SELECTs.
Comment 7•26 years ago
|
||
Not a JS Engine bug. Changing component to HTML Form Controls,
as in related bug 42972 - ?
Assignee: rogerl → rods
Component: Javascript Engine → HTML Form Controls
QA Contact: pschwartau → ckritzer
| Assignee | ||
Comment 8•26 years ago
|
||
My fixes are for both checkboxes and radiobuttons, so i will change bug to
reflect that and I am duping this bug to it.
*** This bug has been marked as a duplicate of 42972 ***
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → DUPLICATE
| Reporter | ||
Comment 9•26 years ago
|
||
Sounds good
You need to log in
before you can comment on or make changes to this bug.
Description
•