From: John Resig Date: Tue, 28 Sep 2010 16:07:57 +0000 (-0700) Subject: Tweak the logic for fixing event.which. Fixes #2338. X-Git-Tag: 1.4.3rc1~34 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e3c4e5789743eecb3cbe2b626f3a5f09c616ee4b;p=jquery.git Tweak the logic for fixing event.which. Fixes #2338. --- diff --git a/src/event.js b/src/event.js index 65b59523e..00bef8472 100644 --- a/src/event.js +++ b/src/event.js @@ -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)