Tweak the logic for fixing event.which. Fixes #2338.

This commit is contained in:
John Resig 2010-09-28 09:07:57 -07:00
parent 9190d4fd60
commit e3c4e57897

View file

@ -470,8 +470,8 @@ jQuery.event = {
}
// Add which for key events
if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
event.which = event.charCode || event.keyCode;
if ( event.which == null && (event.charCode != null || event.charCode != null) ) {
event.which = event.charCode != null ? event.charCode : event.keyCode;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)