prototype: Fix Event#is(Left|Middle|Right)Click in IE. Closes #7520.
This commit is contained in:
parent
082fa20deb
commit
d114e76e97
@ -1,5 +1,7 @@
|
||||
*1.6.0_rc1* (October 16, 2007)
|
||||
|
||||
* Fix Event#is(Left|Middle|Right)Click in IE. Closes #7520 (again). [Mislav Marohnić]
|
||||
|
||||
* Ensure Event.* generic methods work in IE, even when the event is not extended. [Viktor Kojouharov, Andrew Dupont]
|
||||
|
||||
* Don't translate "keypress" events into "keydown" events. [sam]
|
||||
|
17
src/event.js
17
src/event.js
@ -30,24 +30,27 @@ Object.extend(Event, {
|
||||
});
|
||||
|
||||
Event.Methods = (function() {
|
||||
var isButton;
|
||||
|
||||
if (Prototype.Browser.IE) {
|
||||
function isButton(event, code) {
|
||||
return event.button == ({ 0: 1, 1: 4, 2: 2 })[code];
|
||||
}
|
||||
var buttonMap = { 0: 1, 1: 4, 2: 2 };
|
||||
isButton = function(event, code) {
|
||||
return event.button == buttonMap[code];
|
||||
};
|
||||
|
||||
} else if (Prototype.Browser.WebKit) {
|
||||
function isButton(event, code) {
|
||||
isButton = function(event, code) {
|
||||
switch (code) {
|
||||
case 0: return event.which == 1 && !event.metaKey;
|
||||
case 1: return event.which == 1 && event.metaKey;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} else {
|
||||
function isButton(event, code) {
|
||||
isButton = function(event, code) {
|
||||
return event.which ? (event.which === code + 1) : (event.button === code);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user