Skip to content
Browse files

Make sure mouse position is not a factor for .click() in IE 10

  • Loading branch information...
1 parent 1eef1a7 commit 1a2fb4dcea04bb9a2723620a3dbafb81354ec49c @azakus azakus committed
Showing with 4 additions and 2 deletions.
  1. +2 −2 src/standard/gestures.html
  2. +2 −0 test/unit/gestures.html
View
4 src/standard/gestures.html
@@ -124,8 +124,8 @@
var bcr = t.getBoundingClientRect();
// use page x/y to account for scrolling
var x = ev.pageX, y = ev.pageY;
- return (x >= bcr.left && x <= bcr.right) &&
- (y >= bcr.top && y <= bcr.bottom);
+ // ev is a synthetic click if the position is outside the bounding box of the target
+ return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom));
}
return false;
}
View
2 test/unit/gestures.html
@@ -54,6 +54,8 @@
});
test('HTMLElement.click triggers tap', function() {
+ // put the element off screen to prevent x/y weirdness from .click()
+ app.style.cssText = 'position: absolute; left: -1000px; top: -1000px;';
// make a mousedown *very* far away to tickle the distance check
var ev = new CustomEvent('mousedown');
ev.clientX = 1e8;

0 comments on commit 1a2fb4d

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