Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7928

Show
Ignore:
Timestamp:
10/16/07 03:36:58 (11 months ago)
Author:
sam
Message:

prototype: Don't translate "keypress" events into "keydown" events.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/trunk/CHANGELOG

    r7927 r7928  
    11*SVN* 
     2 
     3* Don't translate "keypress" events into "keydown" events.  [sam] 
     4  Note: "keypress" is broken in Safari <= 2.x, but Event#stop has no effect on "keydown" events. 
    25 
    36* Changed Element#makeClipping to remember the original overflow value, even if it's a non-inline style. [Andrew Dupont] 
  • spinoffs/prototype/trunk/src/event.js

    r7926 r7928  
    3131 
    3232Event.Methods = (function() { 
    33   // mouse button detection is terribly inconsistent 
    3433  if (Prototype.Browser.IE) { 
    35     var isButton = function(event, code) { 
    36       return event.button == ({ 0:1, 1:4, 2:2 })[code]; 
    37     }; 
     34    function isButton(event, code) { 
     35      return event.button == ({ 0: 1, 1: 4, 2: 2 })[code]; 
     36    } 
     37     
    3838  } else if (Prototype.Browser.WebKit) { 
    39     var isButton = function(event, code) { 
     39    function isButton(event, code) { 
    4040      switch (code) { 
    4141        case 0: return event.which == 1 && !event.metaKey; 
     
    4343        default: return false; 
    4444      } 
    45     }; 
     45    } 
     46     
    4647  } else { 
    47     var isButton = function(event, code) { 
     48    function isButton(event, code) { 
    4849      return event.which ? (event.which === code + 1) : (event.button === code); 
    49     }; 
     50    } 
    5051  } 
    5152 
     
    130131  function getDOMEventName(eventName) { 
    131132    if (eventName && eventName.match(/:/)) return "dataavailable"; 
    132     return { keypress: "keydown" }[eventName] || eventName; 
     133    return eventName; 
    133134  } 
    134135