diff --git a/CHANGELOG b/CHANGELOG index ad48d77..59548a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ *SVN* +* Don't translate "keypress" events into "keydown" events. [sam] + Note: "keypress" is broken in Safari <= 2.x, but Event#stop has no effect on "keydown" events. + * Changed Element#makeClipping to remember the original overflow value, even if it's a non-inline style. [Andrew Dupont] * Cross-browser Event#isLeftClick with the addition of is(Middle|Right)Click. Closes #7520. [Christophe Porteneuve, Richard Quadling, Mislav Marohnić] diff --git a/src/event.js b/src/event.js index 30b4e8a..e6ff428 100644 --- a/src/event.js +++ b/src/event.js @@ -30,23 +30,24 @@ Object.extend(Event, { }); Event.Methods = (function() { - // mouse button detection is terribly inconsistent if (Prototype.Browser.IE) { - var isButton = function(event, code) { - return event.button == ({ 0:1, 1:4, 2:2 })[code]; - }; + function isButton(event, code) { + return event.button == ({ 0: 1, 1: 4, 2: 2 })[code]; + } + } else if (Prototype.Browser.WebKit) { - var isButton = function(event, code) { + function isButton(event, code) { switch (code) { case 0: return event.which == 1 && !event.metaKey; case 1: return event.which == 1 && event.metaKey; default: return false; } - }; + } + } else { - var isButton = function(event, code) { + function isButton(event, code) { return event.which ? (event.which === code + 1) : (event.button === code); - }; + } } return { @@ -129,7 +130,7 @@ Object.extend(Event, (function() { function getDOMEventName(eventName) { if (eventName && eventName.match(/:/)) return "dataavailable"; - return { keypress: "keydown" }[eventName] || eventName; + return eventName; } function getCacheForID(id) {