r1703 - trunk/ui

r1703 - trunk/ui


Author: paul.bakaus
Date: Tue Jan 20 02:01:49 2009
New Revision: 1703
Modified:
trunk/ui/ui.draggable.js
Log:
draggable: fixed using Array for containment option (fixes #3877)
Modified: trunk/ui/ui.draggable.js
==============================================================================
--- trunk/ui/ui.draggable.js    (original)
+++ trunk/ui/ui.draggable.js    Tue Jan 20 02:01:49 2009
@@ -266,8 +266,8 @@
            ($(o.containment == 'document' ? document : window).height() ||
document.body.parentNode.scrollHeight) - this.helperProportions.height -
this.margins.top
        ];
-        if(!(/^(document|window|parent)$/).test(o.containment)) {
-            var ce = $(o.containment)[0];
+        if(!(/^(document|window|parent)$/).test(o.containment) &&
o.containment.constructor != Array) {
+            var ce = $(o.containment)[0]; if(!ce) return;
            var co = $(o.containment).offset();
            var over = ($(ce).css("overflow") != 'hidden');
@@ -277,6 +277,8 @@
                co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) :
ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) -
this.helperProportions.width - this.margins.left,
                co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) :
ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) -
this.helperProportions.height - this.margins.top
            ];
+        } else if(o.containment.constructor == Array) {
+            this.containment = o.containment;
        }
    },