Skip to content

Commit 1a2fb4d

Browse files
committedAug 5, 2015
Make sure mouse position is not a factor for .click() in IE 10
1 parent 1eef1a7 commit 1a2fb4d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎src/standard/gestures.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
var bcr = t.getBoundingClientRect();
125125
// use page x/y to account for scrolling
126126
var x = ev.pageX, y = ev.pageY;
127-
return (x >= bcr.left && x <= bcr.right) &&
128-
(y >= bcr.top && y <= bcr.bottom);
127+
// ev is a synthetic click if the position is outside the bounding box of the target
128+
return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom));
129129
}
130130
return false;
131131
}

‎test/unit/gestures.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
});
5555

5656
test('HTMLElement.click triggers tap', function() {
57+
// put the element off screen to prevent x/y weirdness from .click()
58+
app.style.cssText = 'position: absolute; left: -1000px; top: -1000px;';
5759
// make a mousedown *very* far away to tickle the distance check
5860
var ev = new CustomEvent('mousedown');
5961
ev.clientX = 1e8;

0 commit comments

Comments
 (0)
Please sign in to comment.