diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2020-08-26 14:10:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 14:10:33 +0200 |
commit | 1a5fff4c169dbaa2df72c656868bcf60ed4413d0 (patch) | |
tree | dd65e0714de02841bb368dce9c7c4cbaa5e8e7a0 /src | |
parent | a1e619b03a557b47c3e26a5e74af12b63a0d5e73 (diff) | |
download | jquery-1a5fff4c169dbaa2df72c656868bcf60ed4413d0.tar.gz jquery-1a5fff4c169dbaa2df72c656868bcf60ed4413d0.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
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 96056a138..b8c5e96fe 100644 --- a/src/event.js +++ b/src/event.js @@ -11,10 +11,7 @@ import nodeName from "./core/nodeName.js"; import "./core/init.js"; import "./selector.js"; -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; @@ -717,34 +714,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 ) { |