aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.draggable.js
diff options
context:
space:
mode:
authorEduardo Lundgren <eduardolundgren@gmail.com>2009-01-16 02:09:45 +0000
committerEduardo Lundgren <eduardolundgren@gmail.com>2009-01-16 02:09:45 +0000
commit8139c81d1b3521c8b8406a3c069c1c8829b05abe (patch)
tree1b1a3d259e4521916f7ec4d510ff5201f43d5ea7 /ui/ui.draggable.js
parent78c4d87d7b2f9f8ece53f062eb44cabf9dd51bf3 (diff)
downloadjquery-ui-8139c81d1b3521c8b8406a3c069c1c8829b05abe.tar.gz
jquery-ui-8139c81d1b3521c8b8406a3c069c1c8829b05abe.zip
Revert changes for #3838 for the release 1.6rc5
Diffstat (limited to 'ui/ui.draggable.js')
-rw-r--r--ui/ui.draggable.js40
1 files changed, 17 insertions, 23 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index fb351b552..a1d17aef4 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -12,15 +12,9 @@
*/
(function($) {
-var widgetName = "draggable";
-var classWidgetName = ".draggable";
-
$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
_init: function() {
- // update widgetName with the name given by the widget factory
- widgetName = this.widgetName;
- classWidgetName = '.' + widgetName;
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
this.element[0].style.position = 'relative';
@@ -33,8 +27,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
},
destroy: function() {
- if(!this.element.data(widgetName)) return;
- this.element.removeData(widgetName).unbind(classWidgetName).removeClass(this.options.cssNamespace+'-draggable '+this.options.cssNamespace+'-draggable-dragging '+this.options.cssNamespace+'-draggable-disabled');
+ if(!this.element.data('draggable')) return;
+ this.element.removeData("draggable").unbind(".draggable").removeClass(this.options.cssNamespace+'-draggable '+this.options.cssNamespace+'-draggable-dragging '+this.options.cssNamespace+'-draggable-disabled');
this._mouseDestroy();
},
@@ -432,10 +426,10 @@ $.extend($.ui.draggable, {
}
});
-$.ui.plugin.add(widgetName, "connectToSortable", {
+$.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui) {
- var inst = $(this).data(widgetName);
+ var inst = $(this).data("draggable");
inst.sortables = [];
$(ui.options.connectToSortable).each(function() {
// 'this' points to a string, and should therefore resolved as query, but instead, if the string is assigned to a variable, it loops through the strings properties,
@@ -457,7 +451,7 @@ $.ui.plugin.add(widgetName, "connectToSortable", {
stop: function(event, ui) {
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
- var inst = $(this).data(widgetName);
+ var inst = $(this).data("draggable");
$.each(inst.sortables, function() {
if(this.instance.isOver) {
@@ -492,7 +486,7 @@ $.ui.plugin.add(widgetName, "connectToSortable", {
},
drag: function(event, ui) {
- var inst = $(this).data(widgetName), self = this;
+ var inst = $(this).data("draggable"), self = this;
var checkPos = function(o) {
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
@@ -562,7 +556,7 @@ $.ui.plugin.add(widgetName, "connectToSortable", {
}
});
-$.ui.plugin.add(widgetName, "cursor", {
+$.ui.plugin.add("draggable", "cursor", {
start: function(event, ui) {
var t = $('body');
if (t.css("cursor")) ui.options._cursor = t.css("cursor");
@@ -573,7 +567,7 @@ $.ui.plugin.add(widgetName, "cursor", {
}
});
-$.ui.plugin.add(widgetName, "iframeFix", {
+$.ui.plugin.add("draggable", "iframeFix", {
start: function(event, ui) {
$(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
@@ -590,7 +584,7 @@ $.ui.plugin.add(widgetName, "iframeFix", {
}
});
-$.ui.plugin.add(widgetName, "opacity", {
+$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) {
var t = $(ui.helper);
if(t.css("opacity")) ui.options._opacity = t.css("opacity");
@@ -601,10 +595,10 @@ $.ui.plugin.add(widgetName, "opacity", {
}
});
-$.ui.plugin.add(widgetName, "scroll", {
+$.ui.plugin.add("draggable", "scroll", {
start: function(event, ui) {
var o = ui.options;
- var i = $(this).data(widgetName);
+ var i = $(this).data("draggable");
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
@@ -612,7 +606,7 @@ $.ui.plugin.add(widgetName, "scroll", {
drag: function(event, ui) {
var o = ui.options, scrolled = false;
- var i = $(this).data(widgetName);
+ var i = $(this).data("draggable");
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
@@ -646,10 +640,10 @@ $.ui.plugin.add(widgetName, "scroll", {
}
});
-$.ui.plugin.add(widgetName, "snap", {
+$.ui.plugin.add("draggable", "snap", {
start: function(event, ui) {
- var inst = $(this).data(widgetName);
+ var inst = $(this).data("draggable");
inst.snapElements = [];
$(ui.options.snap.constructor != String ? ( ui.options.snap.items || ':data(draggable)' ) : ui.options.snap).each(function() {
@@ -664,7 +658,7 @@ $.ui.plugin.add(widgetName, "snap", {
},
drag: function(event, ui) {
- var inst = $(this).data(widgetName);
+ var inst = $(this).data("draggable");
var d = ui.options.snapTolerance;
var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
@@ -715,7 +709,7 @@ $.ui.plugin.add(widgetName, "snap", {
}
});
-$.ui.plugin.add(widgetName, "stack", {
+$.ui.plugin.add("draggable", "stack", {
start: function(event, ui) {
var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
@@ -729,7 +723,7 @@ $.ui.plugin.add(widgetName, "stack", {
}
});
-$.ui.plugin.add(widgetName, "zIndex", {
+$.ui.plugin.add("draggable", "zIndex", {
start: function(event, ui) {
var t = $(ui.helper);
if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");