aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.draggable.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/ui.draggable.js')
-rw-r--r--ui/ui.draggable.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index 31aecff58..e22806b2e 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -16,11 +16,17 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
init: function() {
//Initialize needed constants
- var o = this.options;
+ var o = this.options, positioned = /^(?:r|a|f)/, element = this.element[0];
+
+ if (!this.element.length)
+ return false;
+ var style = element.style || {},
+ position = style.position || "static";
+
//Position the node
- if (o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))
- this.element.css('position', 'relative');
+ if (o.helper == 'original' && !positioned.test(position))
+ style.position = 'relative';
this.element.addClass('ui-draggable');
(o.disabled && this.element.addClass('ui-draggable-disabled'));