Skip to content

Commit

Permalink
Android 2.2 ("Froyo") compatibility improvements:
Browse files Browse the repository at this point in the history
 - Alter a refrence to 'this' in a prototype declaration to 'TouchScroll' to aid what seem to be scope changes
 - Alter addEventListener calls to point directly to the handleEvent function as direct TouchScroll references no longer seem to work
This fixes event registration on Froyo; still tested working on iOS 4, Android 1.5 emulated, BlackBerry Torch browser, desktop WebKit
  • Loading branch information
rowanbeentje authored and davidaurelio committed Sep 1, 2010
1 parent 58589ce commit 656ac1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/touchscroll.js
Expand Up @@ -227,7 +227,7 @@ var TouchScroll = (function(){
event listener. On event, the method is called on the registered object.
*/
TouchScroll.handleEvent = function handleEvent(event){
var currentScroller = this.prototype.currentScroller;
var currentScroller = TouchScroll.prototype.currentScroller;
if(currentScroller){
currentScroller.handleEvent(event);
}else if(event.type === events.move){ // always cancel move events at this point
Expand All @@ -240,9 +240,9 @@ TouchScroll.handleEvent = function handleEvent(event){
Event listening takesplace during bubbling, so other scripts can cancel
scrolling by simply stopping event propagation.
*/
document.addEventListener(events.move, TouchScroll, false);
document.addEventListener(events.end, TouchScroll, false);
document.addEventListener(events.cancel, TouchScroll, false);
document.addEventListener(events.move, TouchScroll.handleEvent, false);
document.addEventListener(events.end, TouchScroll.handleEvent, false);
document.addEventListener(events.cancel, TouchScroll.handleEvent, false);

/**
Constructor for scrollers.
Expand Down

0 comments on commit 656ac1a

Please sign in to comment.