mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
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
This commit is contained in:
parent
a1e619b03a
commit
1a5fff4c16
34
src/event.js
34
src/event.js
@ -11,10 +11,7 @@ import nodeName from "./core/nodeName.js";
|
|||||||
import "./core/init.js";
|
import "./core/init.js";
|
||||||
import "./selector.js";
|
import "./selector.js";
|
||||||
|
|
||||||
var
|
var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
|
||||||
rkeyEvent = /^key/,
|
|
||||||
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
|
|
||||||
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
||||||
|
|
||||||
function returnTrue() {
|
function returnTrue() {
|
||||||
return true;
|
return true;
|
||||||
@ -717,34 +714,7 @@ jQuery.each( {
|
|||||||
targetTouches: true,
|
targetTouches: true,
|
||||||
toElement: true,
|
toElement: true,
|
||||||
touches: true,
|
touches: true,
|
||||||
|
which: 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;
|
|
||||||
}
|
|
||||||
}, jQuery.event.addProp );
|
}, jQuery.event.addProp );
|
||||||
|
|
||||||
jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
|
jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user