]> source.dussan.org Git - jquery-ui.git/commitdiff
Sortable: replaced hard-coded sortable with this.widgetName, and removed lines from...
authorRichard D. Worth <rdworth@gmail.com>
Tue, 27 Sep 2011 11:57:06 +0000 (07:57 -0400)
committerRichard D. Worth <rdworth@gmail.com>
Tue, 27 Sep 2011 11:59:20 +0000 (07:59 -0400)
(cherry picked from commit 228b1b191b4f668a74e7005fc9c8c9250c090aa9)

ui/jquery.ui.sortable.js

index c4814c2aa4a624b749c41b2c9b0d052082d68943..563e63c093f6cf99e9b528e93c107c01246fd047 100644 (file)
@@ -62,13 +62,11 @@ $.widget("ui.sortable", $.ui.mouse, {
 
        destroy: function() {
                this.element
-                       .removeClass("ui-sortable ui-sortable-disabled")
-                       .removeData("sortable")
-                       .unbind(".sortable");
+                       .removeClass("ui-sortable ui-sortable-disabled");
                this._mouseDestroy();
 
                for ( var i = this.items.length - 1; i >= 0; i-- )
-                       this.items[i].item.removeData("sortable-item");
+                       this.items[i].item.removeData(this.widgetName + "-item");
 
                return this;
        },
@@ -86,6 +84,7 @@ $.widget("ui.sortable", $.ui.mouse, {
        },
 
        _mouseCapture: function(event, overrideHandle) {
+               var that = this;
 
                if (this.reverting) {
                        return false;
@@ -98,12 +97,12 @@ $.widget("ui.sortable", $.ui.mouse, {
 
                //Find out if the clicked node (or one of its parents) is a actual item in this.items
                var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
-                       if($.data(this, 'sortable-item') == self) {
+                       if($.data(this, that.widgetName + '-item') == self) {
                                currentItem = $(this);
                                return false;
                        }
                });
-               if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
+               if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
 
                if(!currentItem) return false;
                if(this.options.handle && !overrideHandle) {
@@ -528,7 +527,7 @@ $.widget("ui.sortable", $.ui.mouse, {
                        for (var i = connectWith.length - 1; i >= 0; i--){
                                var cur = $(connectWith[i]);
                                for (var j = cur.length - 1; j >= 0; j--){
-                                       var inst = $.data(cur[j], 'sortable');
+                                       var inst = $.data(cur[j], this.widgetName);
                                        if(inst && inst != this && !inst.options.disabled) {
                                                queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
                                        }
@@ -550,7 +549,7 @@ $.widget("ui.sortable", $.ui.mouse, {
 
        _removeCurrentsFromItems: function() {
 
-               var list = this.currentItem.find(":data(sortable-item)");
+               var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
 
                for (var i=0; i < this.items.length; i++) {
 
@@ -576,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
                        for (var i = connectWith.length - 1; i >= 0; i--){
                                var cur = $(connectWith[i]);
                                for (var j = cur.length - 1; j >= 0; j--){
-                                       var inst = $.data(cur[j], 'sortable');
+                                       var inst = $.data(cur[j], this.widgetName);
                                        if(inst && inst != this && !inst.options.disabled) {
                                                queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
                                                this.containers.push(inst);
@@ -592,7 +591,7 @@ $.widget("ui.sortable", $.ui.mouse, {
                        for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
                                var item = $(_queries[j]);
 
-                               item.data('sortable-item', targetData); // Data for target checking (mouse manager)
+                               item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
 
                                items.push({
                                        item: item,