diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2020-08-26 14:10:33 +0200 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2020-08-26 14:19:24 +0200 |
commit | 2bf9793efc9ff6ab5370119673744e9b43e3b872 (patch) | |
tree | 1614a8bd16192c1e9a3a43d98fa9834e187d1286 /src | |
parent | 3bae54aa50b7485b1f18501dff038a61507012a5 (diff) | |
download | jquery-2bf9793efc9ff6ab5370119673744e9b43e3b872.tar.gz jquery-2bf9793efc9ff6ab5370119673744e9b43e3b872.zip |
Event: Remove the event.which shim
All supported browsers implement this property by themselves. The shim was only
needed for IE <9.
Fixes gh-3235
Closes gh-4765
Ref gh-4755
(cherry picked from commit 1a5fff4c169dbaa2df72c656868bcf60ed4413d0)
Diffstat (limited to 'src')
-rw-r--r-- | src/event.js | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/event.js b/src/event.js index 99ea0fdb8..7d418f113 100644 --- a/src/event.js +++ b/src/event.js @@ -17,10 +17,7 @@ define( [ "use strict"; -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; @@ -749,34 +746,7 @@ jQuery.each( { targetTouches: true, toElement: true, touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } + which: true }, jQuery.event.addProp ); jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { |