Skip to main content

Bug Tracker

Side navigation

#6297 closed enhancement (worksforme)

Opened March 16, 2010 05:03PM UTC

Closed October 07, 2010 08:07PM UTC

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:
Blocked by: Blocking:
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;

});

Attachments (0)
Change History (1)

Changed October 07, 2010 08:07PM UTC by addyosmani comment:1

priority: → undecided
resolution: → worksforme
status: newclosed

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