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

Changeset 6615

Show
Ignore:
Timestamp:
04/28/07 22:52:18 (1 year ago)
Author:
mislav
Message:

Prototype: mouse button detection somewhat fixed (Safari still needs attention); fix event bulk remove for WebKit/KHTML browsers

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/branches/event/src/event.js

    r6613 r6615  
    8181      var local = this.element._observers[this.type]; 
    8282      if (!local) local = this.element._observers[this.type] = {}; 
    83       if (!this.observer.$$guid) this.observer.$$guid = this.constructor.guid++; 
     83      if (!this.observer.$$guid) this.observer.$$guid = Observer.guid++; 
    8484      local[this.observer.$$guid] = this; 
    8585    }, 
     
    190190    }; 
    191191  } 
    192   else var isButton = function(event, code) { return event.button === code }; 
     192  else var isButton = function(event, code) { 
     193    return event.which ? event.which === code+1 : event.button === code; 
     194  }; 
    193195 
    194196  return { 
  • spinoffs/prototype/branches/event/test/functional/event.html

    r6614 r6615  
    102102    var basic_callback = function(e){ 
    103103      $('basic').passed() 
    104       $('basic_remove').show() 
     104      if ($('basic_remove')) $('basic_remove').show() 
     105      else $('basic').failed() 
    105106      log(e) 
    106107    } 
     
    109110      el = $('basic') 
    110111      el.passed('This test should now be inactive (try clicking)') 
    111       el.stopObserving('click', basic_callback
     112      el.stopObserving('click'
    112113      $('basic_remove').remove() 
    113114      log(e) 
     
    266267    Event.observe($A($('list2').childNodes), 'click', function(e){ 
    267268      var list = this.parentNode 
    268                e.stopPropagation() 
     269      e.stopPropagation() 
    269270      $('each2').failed() 
    270271      log(e)