Bug Tracker

Modify

Ticket #5408 (closed bug: duplicate)

Opened 4 years ago

Last modified 16 months ago

event.fix() for keypress() broke detection of Up/Down/etc. keys

Reported by: powerman Owned by: brandon
Priority: major Milestone: 1.4.3
Component: event Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

The event.fix() function (line 2746 in jquery-1.3.2) change value of event.which, and thus broke detection of MANY keys.

For example, on keypress() in Opera-10,
key Up return: keyCode=38, charCode=undefined, which=0
key & (Shift+7) return: keyCode=38, charCode=undefined, which=38

So, only way to distinguish Up and & is check event.which value... but jquery's event.fix() make event.which=event.keyCode.

As workaround one may use instead of

$("#input").keypress(myfunc);

this code:

$("#input").each(function(){
  this.onkeypress=myfunc;
});

Change History

comment:1 Changed 3 years ago by powerman

Ticket #2338 is probably same bug.

comment:2 Changed 3 years ago by john

  • Status changed from new to closed
  • Version changed from 1.3.2 to 1.4.2
  • Resolution set to duplicate
  • Milestone changed from 1.4 to 1.4.3

Yeah, this seems to be the same as #2338, which was just fixed.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.