Skip to content
Browse files

Android 2.2 ("Froyo") compatibility improvements:

 - 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...
1 parent 58589ce commit 656ac1a22cd15156a848fc63bf49ea1b32f55390 @rowanbeentje rowanbeentje committed with
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/touchscroll.js
8 src/touchscroll.js
@@ -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;
}else if(event.type === events.move){ // always cancel move events at this point
@@ -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.

0 comments on commit 656ac1a

Please sign in to comment.
Something went wrong with that request. Please try again.