3737 }
3838} ( function ( $ ) {
3939
40- var formResetHandler = function ( ) {
41- var form = $ ( this ) ;
42-
43- // Wait for the form reset to actually happen before refreshing
44- setTimeout ( function ( ) {
45-
46- // We find .ui-button first, then filter by :ui-button,
47- // because widget pseudo selectors are very very slow, but
48- // we need to filter out CSS-only buttons
49- form . find ( ".ui-button" ) . filter ( ":ui-button" ) . button ( "refresh" ) ;
50- } ) ;
51- } ,
52- forms = { } ;
53-
5440$ . widget ( "ui.button" , {
5541 version : "@VERSION" ,
5642 defaultElement : "<button>" ,
@@ -85,18 +71,6 @@ $.widget( "ui.button", {
8571 } ,
8672
8773 _create : function ( ) {
88- this . formElement = $ ( this . element [ 0 ] . form ) . uniqueId ( ) ;
89- this . formId = this . formElement . attr ( "id" ) ;
90-
91- forms [ this . formId ] = forms [ this . formId ] || 0 ;
92-
93- // We don't use _on and _off here because we want all the checkboxes in the same form to use
94- // single handler which handles all the checkboxradio widgets in the form
95- if ( forms [ this . formId ] === 0 ) {
96- this . formElement . on ( "reset." + this . widgetFullName , formResetHandler ) ;
97- }
98- forms [ this . formId ] ++ ;
99-
10074 if ( ! this . option . showLabel & ! this . options . icon ) {
10175 this . options . showLabel = true ;
10276 }
@@ -182,7 +156,7 @@ $.widget( "ui.button", {
182156 this . icon [ this . _getAttachMethod ( true , icon ? undefined : value ) ] ( this . iconSpace ) ;
183157 } else {
184158 this . _addClass ( this . icon , null , "ui-widget-icon-block" ) ;
185- if ( this . iconSpace ) {
159+ if ( this . iconSpace ) {
186160 this . iconSpace . remove ( ) ;
187161 }
188162 }
@@ -200,11 +174,6 @@ $.widget( "ui.button", {
200174 if ( ! this . hasTitle ) {
201175 this . element . removeAttr ( "title" ) ;
202176 }
203-
204- forms [ this . formId ] -- ;
205- if ( forms [ this . formId ] === 0 ) {
206- this . formElement . off ( "reset." + this . widgetFullName , formResetHandler ) ;
207- }
208177 } ,
209178
210179 _getAttachMethod : function ( space , position ) {
0 commit comments