aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-05-13 12:17:33 -0700
committerScott González <scott.gonzalez@gmail.com>2011-05-13 12:17:33 -0700
commitaec3f1893276bbb5ace7ae6d2b340f273489160c (patch)
treec0fa09ce06f9b07a1f4fff69678d737b904de27f
parentc08cf8ec6cc9c420173afda79b55c6c32ab89beb (diff)
parentd136e4333e117b33aa16eb9a3a5831a25b1a2dd9 (diff)
downloadjquery-ui-aec3f1893276bbb5ace7ae6d2b340f273489160c.tar.gz
jquery-ui-aec3f1893276bbb5ace7ae6d2b340f273489160c.zip
Merge pull request #268 from kborchers/bug_6950
Draggable: Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE. Fixed #6950 - ie 8 invalid drag and drop error
-rw-r--r--ui/jquery.ui.draggable.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index d7bc09578..10d7e8a13 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -436,10 +436,11 @@ $.widget("ui.draggable", $.ui.mouse, {
}
if(o.grid) {
- var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
- var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
}