Draggable: Use 'that' instead of 'self'. Partial fix for #5404 - remove uses of 'var self = this;'

This commit is contained in:
Scott González 2012-02-12 09:30:05 -05:00
parent d2d301f074
commit 861842d361

View File

@ -212,10 +212,10 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
var self = this;
var that = this;
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
if(self._trigger("stop", event) !== false) {
self._clear();
if(that._trigger("stop", event) !== false) {
that._clear();
}
});
} else {
@ -558,7 +558,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
},
drag: function(event, ui) {
var inst = $(this).data("draggable"), self = this;
var inst = $(this).data("draggable"), that = this;
var checkPos = function(o) {
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
@ -585,7 +585,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
this.instance.options.helper = function() { return ui.helper[0]; };