Skip to content

Commit

Permalink
Use setTimeout(..., 0) to send the click event from touch.js
Browse files Browse the repository at this point in the history
  • Loading branch information
vingtetun committed Dec 7, 2011
1 parent fd49e33 commit 481bca3
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions b2g/chrome/content/touch.js
Expand Up @@ -116,18 +116,17 @@
// Mouse events has been cancelled so dispatch a sequence
// of events to where touchend has been fired
if (preventMouseEvents) {
let target = evt.target;
ignoreEvents = true;
try {
this.fireMouseEvent('mousemove', evt);
this.fireMouseEvent('mousedown', evt);
this.fireMouseEvent('mouseup', evt);
} catch (e) {
alert(e);
}
evt.preventDefault();
evt.stopPropagation();
ignoreEvents = false;

let target = evt.target;
ignoreEvents = true;
window.setTimeout(function dispatchMouseEvents(self) {
self.fireMouseEvent('mousemove', evt);
self.fireMouseEvent('mousedown', evt);
self.fireMouseEvent('mouseup', evt);
ignoreEvents = false;
}, 0, this);
}

debug('click: fire');
Expand Down

0 comments on commit 481bca3

Please sign in to comment.