Skip to content
Permalink
Browse files

Draggable: Use 'that' instead of 'self'. Partial fix for #5404 - remo…

…ve uses of 'var self = this;'
  • Loading branch information
scottgonzalez committed Feb 12, 2012
1 parent d2d301f commit 861842d361d053aed02895a57becaa28a95696eb
Showing with 5 additions and 5 deletions.
  1. +5 −5 ui/jquery.ui.draggable.js
@@ -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]; };

0 comments on commit 861842d

Please sign in to comment.
You can’t perform that action at this time.