Skip to content

Commit 861842d

Browse files
committed
Draggable: Use 'that' instead of 'self'. Partial fix for #5404 - remove uses of 'var self = this;'
1 parent d2d301f commit 861842d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ui/jquery.ui.draggable.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ $.widget("ui.draggable", $.ui.mouse, {
212212
return false;
213213

214214
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))) {
215-
var self = this;
215+
var that = this;
216216
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
217-
if(self._trigger("stop", event) !== false) {
218-
self._clear();
217+
if(that._trigger("stop", event) !== false) {
218+
that._clear();
219219
}
220220
});
221221
} else {
@@ -558,7 +558,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
558558
},
559559
drag: function(event, ui) {
560560

561-
var inst = $(this).data("draggable"), self = this;
561+
var inst = $(this).data("draggable"), that = this;
562562

563563
var checkPos = function(o) {
564564
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
@@ -585,7 +585,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
585585
//Now we fake the start of dragging for the sortable instance,
586586
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
587587
//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)
588-
this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
588+
this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
589589
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
590590
this.instance.options.helper = function() { return ui.helper[0]; };
591591

0 commit comments

Comments
 (0)