@@ -73,8 +73,8 @@ $.widget( "ui.button", {
7373 } ,
7474 _create : function ( ) {
7575 this . element . closest ( "form" )
76- . unbind ( "reset" + this . eventNamespace )
77- . bind ( "reset" + this . eventNamespace , formResetHandler ) ;
76+ . off ( "reset" + this . eventNamespace )
77+ . on ( "reset" + this . eventNamespace , formResetHandler ) ;
7878
7979 if ( typeof this . options . disabled !== "boolean" ) {
8080 this . options . disabled = ! ! this . element . prop ( "disabled" ) ;
@@ -99,21 +99,21 @@ $.widget( "ui.button", {
9999 this . buttonElement
100100 . addClass ( baseClasses )
101101 . attr ( "role" , "button" )
102- . bind ( "mouseenter" + this . eventNamespace , function ( ) {
102+ . on ( "mouseenter" + this . eventNamespace , function ( ) {
103103 if ( options . disabled ) {
104104 return ;
105105 }
106106 if ( this === lastActive ) {
107107 $ ( this ) . addClass ( "ui-state-active" ) ;
108108 }
109109 } )
110- . bind ( "mouseleave" + this . eventNamespace , function ( ) {
110+ . on ( "mouseleave" + this . eventNamespace , function ( ) {
111111 if ( options . disabled ) {
112112 return ;
113113 }
114114 $ ( this ) . removeClass ( activeClass ) ;
115115 } )
116- . bind ( "click" + this . eventNamespace , function ( event ) {
116+ . on ( "click" + this . eventNamespace , function ( event ) {
117117 if ( options . disabled ) {
118118 event . preventDefault ( ) ;
119119 event . stopImmediatePropagation ( ) ;
@@ -132,19 +132,19 @@ $.widget( "ui.button", {
132132 } ) ;
133133
134134 if ( toggleButton ) {
135- this . element . bind ( "change" + this . eventNamespace , function ( ) {
135+ this . element . on ( "change" + this . eventNamespace , function ( ) {
136136 that . refresh ( ) ;
137137 } ) ;
138138 }
139139
140140 if ( this . type === "checkbox" ) {
141- this . buttonElement . bind ( "click" + this . eventNamespace , function ( ) {
141+ this . buttonElement . on ( "click" + this . eventNamespace , function ( ) {
142142 if ( options . disabled ) {
143143 return false ;
144144 }
145145 } ) ;
146146 } else if ( this . type === "radio" ) {
147- this . buttonElement . bind ( "click" + this . eventNamespace , function ( ) {
147+ this . buttonElement . on ( "click" + this . eventNamespace , function ( ) {
148148 if ( options . disabled ) {
149149 return false ;
150150 }
@@ -162,7 +162,7 @@ $.widget( "ui.button", {
162162 } ) ;
163163 } else {
164164 this . buttonElement
165- . bind ( "mousedown" + this . eventNamespace , function ( ) {
165+ . on ( "mousedown" + this . eventNamespace , function ( ) {
166166 if ( options . disabled ) {
167167 return false ;
168168 }
@@ -172,13 +172,13 @@ $.widget( "ui.button", {
172172 lastActive = null ;
173173 } ) ;
174174 } )
175- . bind ( "mouseup" + this . eventNamespace , function ( ) {
175+ . on ( "mouseup" + this . eventNamespace , function ( ) {
176176 if ( options . disabled ) {
177177 return false ;
178178 }
179179 $ ( this ) . removeClass ( "ui-state-active" ) ;
180180 } )
181- . bind ( "keydown" + this . eventNamespace , function ( event ) {
181+ . on ( "keydown" + this . eventNamespace , function ( event ) {
182182 if ( options . disabled ) {
183183 return false ;
184184 }
@@ -188,15 +188,15 @@ $.widget( "ui.button", {
188188 } )
189189 // see #8559, we bind to blur here in case the button element loses
190190 // focus between keydown and keyup, it would be left in an "active" state
191- . bind ( "keyup" + this . eventNamespace + " blur" + this . eventNamespace , function ( ) {
191+ . on ( "keyup" + this . eventNamespace + " blur" + this . eventNamespace , function ( ) {
192192 $ ( this ) . removeClass ( "ui-state-active" ) ;
193193 } ) ;
194194
195195 if ( this . buttonElement . is ( "a" ) ) {
196- this . buttonElement . keyup ( function ( event ) {
196+ this . buttonElement . on ( "keyup" , function ( event ) {
197197 if ( event . keyCode === $ . ui . keyCode . SPACE ) {
198198 // TODO pass through original event correctly (just as 2nd argument doesn't work)
199- $ ( this ) . click ( ) ;
199+ $ ( this ) . trigger ( "click" ) ;
200200 }
201201 } ) ;
202202 }
0 commit comments