Bug Tracker

Opened 9 years ago

Closed 9 years ago

#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:
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 ];

}

Change History (9)

comment:1 Changed 9 years ago by anonymous

comment:2 Changed 9 years ago by Rick Waldron

Component: unfiledevent

comment:3 Changed 9 years ago by Rick Waldron

Owner: set to giovanni.g@…
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

comment:4 Changed 9 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 9 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 9 years ago by Rick Waldron

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.

comment:7 Changed 9 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 9 years ago by Rick Waldron

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"

comment:9 Changed 9 years ago by addyosmani

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.

Note: See TracTickets for help on using tickets.