Skip to content
Permalink
Browse files

Button: Use 'that' instead of 'self'. Partial fix for #5404 - remove …

…uses of 'var self = this;'
  • Loading branch information
scottgonzalez committed Feb 12, 2012
1 parent 5c7be47 commit 41a1472469df35005d04e1a2b5e8b756980a4e7e
Showing with 8 additions and 8 deletions.
  1. +8 −8 ui/jquery.ui.button.js
@@ -66,7 +66,7 @@ $.widget( "ui.button", {
this._determineButtonType();
this.hasTitle = !!this.buttonElement.attr( "title" );

var self = this,
var that = this,
options = this.options,
toggleButton = this.type === "checkbox" || this.type === "radio",
hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
@@ -104,18 +104,18 @@ $.widget( "ui.button", {
this.element
.bind( "focus.button", function() {
// no need to check disabled, focus won't be triggered anyway
self.buttonElement.addClass( focusClass );
that.buttonElement.addClass( focusClass );
})
.bind( "blur.button", function() {
self.buttonElement.removeClass( focusClass );
that.buttonElement.removeClass( focusClass );
});

if ( toggleButton ) {
this.element.bind( "change.button", function() {
if ( clickDragged ) {
return;
}
self.refresh();
that.refresh();
});
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
// prevents issue where button state changes but checkbox/radio checked state
@@ -145,17 +145,17 @@ $.widget( "ui.button", {
return false;
}
$( this ).toggleClass( "ui-state-active" );
self.buttonElement.attr( "aria-pressed", self.element[0].checked );
that.buttonElement.attr( "aria-pressed", that.element[0].checked );
});
} else if ( this.type === "radio" ) {
this.buttonElement.bind( "click.button", function() {
if ( options.disabled || clickDragged ) {
return false;
}
$( this ).addClass( "ui-state-active" );
self.buttonElement.attr( "aria-pressed", "true" );
that.buttonElement.attr( "aria-pressed", "true" );

var radio = self.element[ 0 ];
var radio = that.element[ 0 ];
radioGroup( radio )
.not( radio )
.map(function() {
@@ -172,7 +172,7 @@ $.widget( "ui.button", {
}
$( this ).addClass( "ui-state-active" );
lastActive = this;
self.document.one( "mouseup", function() {
that.document.one( "mouseup", function() {
lastActive = null;
});
})

0 comments on commit 41a1472

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