Skip to main content

Bug Tracker

Side navigation

#8595 closed bug (invalid)

Opened March 22, 2011 09:59PM UTC

Closed March 25, 2011 05:15PM UTC

tedious bug in FF 3.x about charCode in keyup/keydown events

Reported by: giovanni.g@gmail.com Owned by: giovanni.g@gmail.com
Priority: low Milestone: 1.next
Component: event Version: 1.5.1
Keywords: needsreview Cc:
Blocked by: Blocking:
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."

+ if ((prop == "charCode") && ((event.type == "keydown") || (event.type == "keyup")))

+ continue;

event[ prop ] = originalEvent[ prop ];

}

Attachments (0)
Change History (9)

Changed March 22, 2011 09:59PM UTC by anonymous comment:1

see pull request #282 on github.

https://github.com/jquery/jquery/pull/282

Changed March 23, 2011 02:06AM UTC by rwaldron comment:2

component: unfiledevent

Changed March 23, 2011 02:19AM UTC by rwaldron comment:3

owner: → giovanni.g@gmail.com
status: newpending

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

Changed March 23, 2011 03:18AM UTC by Giovanni Giacobbi <giovanni.g@gmail.com> comment:4

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.

Changed March 23, 2011 03:24AM UTC by Giovanni Giacobbi <giovanni.g@gmail.com> comment:5

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.

Changed March 23, 2011 01:34PM UTC by rwaldron comment:6

priority: undecidedlow

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.

Changed March 23, 2011 04:44PM UTC by Giovanni Giacobbi <giovanni.g@gmail.com> comment:7

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.

Changed March 23, 2011 06:08PM UTC by rwaldron comment:8

keywords: → needsreview

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"

Changed March 25, 2011 05:15PM UTC by addyosmani comment:9

resolution: → invalid
status: pendingclosed

Tested again using Firebug and FF4 final + 3.6 and haven't been able to reproduce this issue either. Closing unless someone else can verify this behavior is indeed present.