summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard D. Worth <rdworth@gmail.com>2011-05-26 04:58:15 -0400
committerRichard D. Worth <rdworth@gmail.com>2011-05-26 05:09:03 -0400
commitbb076e313f6b5ca68435bdc0dd179f4173368c85 (patch)
tree8bfed77c1e27eb05ab83ab1aa8a8ced5c03c7b60
parented65ce7a14882df12d2e029a4be84680a8b68240 (diff)
downloadjquery-ui-bb076e313f6b5ca68435bdc0dd179f4173368c85.tar.gz
jquery-ui-bb076e313f6b5ca68435bdc0dd179f4173368c85.zip
Simulate: account for document scroll in findCenter function. Fixes #6859 - Jquery.Simulate drag behaves incorrect when container scrolled
(cherry picked from commit de3fc0050ee672ce155f0dd65ee9ecdfd818c063)
-rw-r--r--tests/jquery.simulate.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js
index a88b6cbe4..bb82624d3 100644
--- a/tests/jquery.simulate.js
+++ b/tests/jquery.simulate.js
@@ -123,10 +123,10 @@ $.extend($.simulate.prototype, {
this.simulateEvent(target, "click", coord);
},
findCenter: function(el) {
- var el = $(this.target), o = el.offset();
+ var el = $(this.target), o = el.offset(), d = $(document);
return {
- x: o.left + el.outerWidth() / 2,
- y: o.top + el.outerHeight() / 2
+ x: o.left + el.outerWidth() / 2 - d.scrollLeft(),
+ y: o.top + el.outerHeight() / 2 - d.scrollTop()
};
}
});