@@ -223,9 +223,84 @@ $.widget( "ui.button", {
223
223
224
224
this . _updateTooltip ( ) ;
225
225
}
226
-
227
226
} ) ;
228
227
228
+ // DEPRECATED
229
+ if ( $ . uiBackCompat ) {
230
+
231
+ // Text and Icons options
232
+ $ . widget ( "ui.button" , $ . ui . button , {
233
+ options : {
234
+ text : true ,
235
+ icons : {
236
+ primary : null ,
237
+ secondary : null
238
+ }
239
+ } ,
240
+
241
+ _create : function ( ) {
242
+ if ( this . options . showLabel && ! this . options . text ) {
243
+ this . options . showLabel = this . options . text ;
244
+ }
245
+ if ( ! this . options . icon && ( this . options . icons . primary ||
246
+ this . options . icons . secondary ) ) {
247
+ if ( this . options . icons . primary ) {
248
+ this . options . icon = this . options . icons . primary ;
249
+ } else {
250
+ this . options . icon = this . options . icons . secondary ;
251
+ this . options . iconPosition = "end" ;
252
+ }
253
+ }
254
+ this . _super ( ) ;
255
+ } ,
256
+
257
+ _setOption : function ( key , value ) {
258
+ if ( key === "text" ) {
259
+ this . _setOption ( "showLabel" , value ) ;
260
+ }
261
+ if ( key === "icons" ) {
262
+ this . _setOption ( "icon" , value ) ;
263
+ if ( value . primary ) {
264
+ this . _setOption ( "icon" , value ) ;
265
+ this . _setOption ( "iconPosition" , "beginning" ) ;
266
+ } else if ( value . secondary ) {
267
+ this . _setOption ( "icon" , value ) ;
268
+ this . _setOption ( "iconPosition" , "end" ) ;
269
+ }
270
+ }
271
+ this . _superApply ( arguments ) ;
272
+ }
273
+ } ) ;
274
+ $ . fn . button = ( function ( orig ) {
275
+ return function ( ) {
276
+ if ( this [ 0 ] . tagName === "input" && ( this . attr ( "type" ) === "checkbox" ||
277
+ this . attr ( "type" ) === "radio" ) ) {
278
+ if ( $ . ui . checkboxradio ) {
279
+ if ( arguments . length === 0 ) {
280
+ return this . checkboxradio ( {
281
+ "icon" : false
282
+ } ) ;
283
+ } else {
284
+ return this . checkboxradio . apply ( arguments ) ;
285
+ }
286
+ } else {
287
+ $ . error ( "Checkboxradio widget missing" ) ;
288
+ }
289
+ } else {
290
+ return orig . apply ( this , arguments ) ;
291
+ }
292
+ } ;
293
+ } ) ( $ . fn . button ) ;
294
+ $ . fn . buttonset = function ( method , key , value ) {
295
+ if ( method === "option" && key === "items" ) {
296
+ value = {
297
+ "button" : value
298
+ } ;
299
+ }
300
+ this . controlgroup . call ( method , key , value ) ;
301
+ } ;
302
+ }
303
+
229
304
return $ . ui . button ;
230
305
231
306
} ) ) ;
0 commit comments