1.8rc2: bug #4838 still not fixed, here's a potential patch
Bug #4838 <
http://dev.jqueryui.com/ticket/4838> ("containment: 'document' is incorrect for top and left in draggable") is still present in jQuery UI 1.8rc2.
Three months ago joern.zaefferer marked it as "priority: major" and "milestone: 1.8", so is it still going to be fixed before 1.8?
A two-liner patch that fixes the problem for me is:
- --- jquery.ui.draggable.js.orig 2010-02-18 22:59:18.000000000 +0100
+++ jquery.ui.draggable.js 2010-02-18 23:00:57.000000000 +0100
@@ -333,8 +333,8 @@
var o = this.options;
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
if(o.containment == 'document' || o.containment == 'window') this.containment = [
- 0 - this.offset.relative.left - this.offset.parent.left,
- 0 - this.offset.relative.top - this.offset.parent.top,
+ 0,
+ 0,
$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
But someone more familiar than me with the code needs to review it and make sure it doesn't regress the bugs fixed by
changeset 211.