Bug Tracker

Modify

Ticket #6297 (closed enhancement: worksforme)

Opened 3 years ago

Last modified 3 years ago

Keypress event's which property doesn't work as expected

Reported by: HTD Owned by:
Priority: undecided Milestone: 1.4.3
Component: event Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

Following code should report the same numbers. Depending on browser - it doesn't. Check with latest stable FireFox and Opera.

$('input').bind('keypress', function(e) {

var k1, k2; k1 = e.which; k2 = e.keyCode; if (!k2) k2 = e.charCode; document.title = k1 + ' / ' + k2;

});

Change History

comment:1 Changed 3 years ago by addyosmani

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to worksforme

I re-created and extended your original test and ran it against the following browsers with an output/key test of typing out 'jquery' into the input text field (Live test case:  http://jsfiddle.net/addyosmani/rZ4DQ/4/)

As you can see, the same output is experienced across all browsers using jQuery 1.4.2 confirming that this is working fine. If you have additional information regarding this bug that you would like to submit, please open a new ticket.

FireFox 3.6.10: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121

Google Chrome 6.04: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121

Safari 5.02: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121

Opera 10.62: 106 / 106 113 / 113 117 / 117 101 / 101 114 / 114 121 / 121

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.