Mouse: 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:31:06 -05:00
parent 861842d361
commit f813481117

16
ui/jquery.ui.mouse.js vendored
View File

@ -25,15 +25,15 @@ $.widget("ui.mouse", {
delay: 0
},
_mouseInit: function() {
var self = this;
var that = this;
this.element
.bind('mousedown.'+this.widgetName, function(event) {
return self._mouseDown(event);
return that._mouseDown(event);
})
.bind('click.'+this.widgetName, function(event) {
if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
$.removeData(event.target, self.widgetName + '.preventClickEvent');
if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
$.removeData(event.target, that.widgetName + '.preventClickEvent');
event.stopImmediatePropagation();
return false;
}
@ -57,7 +57,7 @@ $.widget("ui.mouse", {
this._mouseDownEvent = event;
var self = this,
var that = this,
btnIsLeft = (event.which == 1),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
@ -69,7 +69,7 @@ $.widget("ui.mouse", {
this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
self.mouseDelayMet = true;
that.mouseDelayMet = true;
}, this.options.delay);
}
@ -88,10 +88,10 @@ $.widget("ui.mouse", {
// these delegates are required to keep context
this._mouseMoveDelegate = function(event) {
return self._mouseMove(event);
return that._mouseMove(event);
};
this._mouseUpDelegate = function(event) {
return self._mouseUp(event);
return that._mouseUp(event);
};
$(document)
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)