aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorEduardo Lundgren <eduardolundgren@gmail.com>2008-07-10 23:47:00 +0000
committerEduardo Lundgren <eduardolundgren@gmail.com>2008-07-10 23:47:00 +0000
commit184f890e069cd0225911db5724894b31bbd00927 (patch)
treeb957d7296a12a4aa8445f3c4267a0a7a3db68199 /ui
parent45bb23e02be52208b5e6cb35416aba8a9b07b14a (diff)
downloadjquery-ui-184f890e069cd0225911db5724894b31bbd00927.tar.gz
jquery-ui-184f890e069cd0225911db5724894b31bbd00927.zip
Minorl performance improvements at draggable init
Diffstat (limited to 'ui')
-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'));