Ticket #8595 (closed bug: invalid)
tedious bug in FF 3.x about charCode in keyup/keydown events
| Reported by: | giovanni.g@… | Owned by: | giovanni.g@… |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | event | Version: | 1.5.1 |
| Keywords: | needsreview | Cc: | |
| Blocking: | Blocked by: |
Description
@@ -469,6 +469,10 @@ jQuery.event = {
for ( var i = this.props.length, prop; i; ) {
prop = this.props[ --i ];
+ avoid a tedious warning with FF 3.x like:
+ "The 'charCode' property of a keydown event should not be used. The value is meaningless."
| (event.type == "keyup"))) |
+ continue;
event[ prop ] = originalEvent[ prop ];
}
Change History
comment:3 Changed 2 years ago by rwaldron
- Owner set to giovanni.g@…
- Status changed from new to pending
As noted in the pull request - please provide a test case that illustrates this issue. Please also read http://docs.jquery.com/Tips_for_jQuery_Bug_Patching
comment:4 Changed 2 years ago by Giovanni Giacobbi <giovanni.g@…>
Here is your reduced test case:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
$(function() {
$("input").keydown($.noop);
});
</script>
</head>
<form><input type="text" /></form>
<body>
</body>
</html>
error you get:
The 'charCode' property of a keydown event should not be used. The value is meaningless.
Tested on Firefox 3.6.15, but all 3.6.x are affected and probably all 3.x if i recall correctly.
comment:5 Changed 2 years ago by Giovanni Giacobbi <giovanni.g@…>
the change i proposed in pull req #282 cannot hurt any browser because it's only string operations, and standards say that charCode is meaningless in keyUp and keyDown events.
https://github.com/jquery/jquery/pull/282
If you really want to be safe I can change my proposed patch to this:
// Avoid a tedious warning (#8595) with Firefox 3.x like:
// "The 'charCode' property of a keydown event should not be used. The value is meaningless."
if ( prop === "charCode" && ( event.type === "keydown" || event.type === "keyup" ) ) {
event[ prop ] = null;
}
else {
event[ prop ] = originalEvent[ prop ];
}
in this case from the user point of view there is absolutely no difference.
comment:6 Changed 2 years ago by rwaldron
- Priority changed from undecided to low
As it says in the big red box on the page that you filed the bug and also, right above this box, reduced test cases should be created with jsfiddle...
http://jsfiddle.net/rwaldron/PCHHX/
Cannot reproduce.
comment:7 Changed 2 years ago by Giovanni Giacobbi <giovanni.g@…>
I tried, it does reproduce it with firefox 3.6.15 and 3.6.16 on windows (both vista and xp), but it does not appear in firebug lite, you have to go to tools / error console. It does appear on regular firebug though.
comment:8 Changed 2 years ago by rwaldron
- Keywords needsreview added
I ran the test several times, several different ways (using jQuery trigger and also typing in the input to trigger a native event) using all three: FB Lite, FB Regular and Firefox error console. I tested in 3.0.19, 3.6.16, 4b13pre & 4
No luck reproducing this error.
Marking as "needsreview"
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

see pull request #282 on github. https://github.com/jquery/jquery/pull/282