diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-06-14 12:33:16 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-06-14 12:33:16 -0400 |
commit | ff39bed57a05ca060033187b8aecebafab357f78 (patch) | |
tree | e82f4c3faa3b5269f0f86e3f186a6f3024ad7466 /ui/jquery.ui.button.js | |
parent | 00d4beb0ca4a99933bb7e786a1dd50618c180a0b (diff) | |
download | jquery-ui-ff39bed57a05ca060033187b8aecebafab357f78.tar.gz jquery-ui-ff39bed57a05ca060033187b8aecebafab357f78.zip |
Widget: Added _off() for removing event handlers. Fixes #7795 - Widget: _on and _off.
Diffstat (limited to 'ui/jquery.ui.button.js')
-rw-r--r-- | ui/jquery.ui.button.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 810191775..0c72e9c4b 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -54,8 +54,8 @@ $.widget( "ui.button", { }, _create: function() { this.element.closest( "form" ) - .unbind( "reset.button" ) - .bind( "reset.button", formResetHandler ); + .unbind( "reset" + this.eventNamespace ) + .bind( "reset" + this.eventNamespace, formResetHandler ); if ( typeof this.options.disabled !== "boolean" ) { this.options.disabled = !!this.element.prop( "disabled" ); @@ -79,7 +79,7 @@ $.widget( "ui.button", { this.buttonElement .addClass( baseClasses ) .attr( "role", "button" ) - .bind( "mouseenter.button", function() { + .bind( "mouseenter" + this.eventNamespace, function() { if ( options.disabled ) { return; } @@ -88,13 +88,13 @@ $.widget( "ui.button", { $( this ).addClass( "ui-state-active" ); } }) - .bind( "mouseleave.button", function() { + .bind( "mouseleave" + this.eventNamespace, function() { if ( options.disabled ) { return; } $( this ).removeClass( hoverClass ); }) - .bind( "click.button", function( event ) { + .bind( "click" + this.eventNamespace, function( event ) { if ( options.disabled ) { event.preventDefault(); event.stopImmediatePropagation(); @@ -102,16 +102,16 @@ $.widget( "ui.button", { }); this.element - .bind( "focus.button", function() { + .bind( "focus" + this.eventNamespace, function() { // no need to check disabled, focus won't be triggered anyway that.buttonElement.addClass( focusClass ); }) - .bind( "blur.button", function() { + .bind( "blur" + this.eventNamespace, function() { that.buttonElement.removeClass( focusClass ); }); if ( toggleButton ) { - this.element.bind( "change.button", function() { + this.element.bind( "change" + this.eventNamespace, function() { if ( clickDragged ) { return; } @@ -121,7 +121,7 @@ $.widget( "ui.button", { // prevents issue where button state changes but checkbox/radio checked state // does not in Firefox (see ticket #6970) this.buttonElement - .bind( "mousedown.button", function( event ) { + .bind( "mousedown" + this.eventNamespace, function( event ) { if ( options.disabled ) { return; } @@ -129,7 +129,7 @@ $.widget( "ui.button", { startXPos = event.pageX; startYPos = event.pageY; }) - .bind( "mouseup.button", function( event ) { + .bind( "mouseup" + this.eventNamespace, function( event ) { if ( options.disabled ) { return; } @@ -140,7 +140,7 @@ $.widget( "ui.button", { } if ( this.type === "checkbox" ) { - this.buttonElement.bind( "click.button", function() { + this.buttonElement.bind( "click" + this.eventNamespace, function() { if ( options.disabled || clickDragged ) { return false; } @@ -148,7 +148,7 @@ $.widget( "ui.button", { that.buttonElement.attr( "aria-pressed", that.element[0].checked ); }); } else if ( this.type === "radio" ) { - this.buttonElement.bind( "click.button", function() { + this.buttonElement.bind( "click" + this.eventNamespace, function() { if ( options.disabled || clickDragged ) { return false; } @@ -166,7 +166,7 @@ $.widget( "ui.button", { }); } else { this.buttonElement - .bind( "mousedown.button", function() { + .bind( "mousedown" + this.eventNamespace, function() { if ( options.disabled ) { return false; } @@ -176,13 +176,13 @@ $.widget( "ui.button", { lastActive = null; }); }) - .bind( "mouseup.button", function() { + .bind( "mouseup" + this.eventNamespace, function() { if ( options.disabled ) { return false; } $( this ).removeClass( "ui-state-active" ); }) - .bind( "keydown.button", function(event) { + .bind( "keydown" + this.eventNamespace, function(event) { if ( options.disabled ) { return false; } @@ -190,7 +190,7 @@ $.widget( "ui.button", { $( this ).addClass( "ui-state-active" ); } }) - .bind( "keyup.button", function() { + .bind( "keyup" + this.eventNamespace, function() { $( this ).removeClass( "ui-state-active" ); }); |