Skip to content

Commit 66f9e12

Browse files
committed
Widget: Remove method argument from _super and _superApply. Was a left-over from first implementation, not necessary anymore.
1 parent e6f5596 commit 66f9e12

11 files changed

+47
-47
lines changed

demos/widget/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
// always refresh when changing options
107107
_setOptions: function() {
108108
// _super and _superApply handle keeping the right this-context
109-
this._superApply( "_setOptions", arguments );
109+
this._superApply( arguments );
110110
this._refresh();
111111
},
112112

@@ -116,7 +116,7 @@
116116
if ( /red|green|blue/.test(key) && (value < 0 || value > 255) ) {
117117
return;
118118
}
119-
this._super( "_setOption", key, value );
119+
this._super( key, value );
120120
}
121121
});
122122

tests/unit/widget/widget_core.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,15 @@ test( "._super()", function() {
346346
same( this, instance, "this is correct in testWidget2" );
347347
same( a, 5, "parameter passed to testWidget2" );
348348
same( b, 10, "parameter passed to testWidget2" );
349-
return this._super( "method", a, b*2 );
349+
return this._super( a, b*2 );
350350
}
351351
});
352352

353353
$.widget( "ui.testWidget3", $.ui.testWidget2, {
354354
method: function( a ) {
355355
same( this, instance, "this is correct in testWidget3" );
356356
same( a, 5, "parameter passed to testWidget3" );
357-
var ret = this._super( "method", a, a*2 );
357+
var ret = this._super( a, a*2 );
358358
same( ret, 25, "super returned value" );
359359
}
360360
});
@@ -382,7 +382,7 @@ test( "._superApply()", function() {
382382
same( this, instance, "this is correct in testWidget2" );
383383
same( a, 5, "parameter passed to testWidget2" );
384384
same( b, 10, "second parameter passed to testWidget2" );
385-
return this._superApply( "method", arguments );
385+
return this._superApply( arguments );
386386
}
387387
});
388388

@@ -391,7 +391,7 @@ test( "._superApply()", function() {
391391
same( this, instance, "this is correct in testWidget3" );
392392
same( a, 5, "parameter passed to testWidget3" );
393393
same( b, 10, "second parameter passed to testWidget3" );
394-
var ret = this._superApply( "method", arguments );
394+
var ret = this._superApply( arguments );
395395
same( ret, 15, "super returned value" );
396396
}
397397
});
@@ -1031,7 +1031,7 @@ test( "redefine", function() {
10311031
$.widget( "ui.testWidget", $.ui.testWidget, {
10321032
method: function( str ) {
10331033
equal( str, "foo", "new invoked with correct parameter" );
1034-
this._super( "method", "bar" );
1034+
this._super();
10351035
}
10361036
});
10371037

ui/jquery.ui.accordion.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* jquery.ui.widget.js
1313
*/
1414
(function( $, undefined ) {
15-
15+
1616
// TODO: use ui-accordion-header-active class and fix styling
1717
$.widget( "ui.accordion", {
1818
version: "@VERSION",
@@ -167,7 +167,7 @@ $.widget( "ui.accordion", {
167167
this._setupEvents( value );
168168
}
169169

170-
this._super( "_setOption", key, value );
170+
this._super( key, value );
171171

172172
// setting collapsible: false while collapsed; open first panel
173173
if ( key === "collapsible" && !value && this.options.active === false ) {
@@ -244,7 +244,7 @@ $.widget( "ui.accordion", {
244244
if ( position === "absolute" || position === "fixed" ) {
245245
return;
246246
}
247-
maxHeight -= elem.outerHeight( true );
247+
maxHeight -= elem.outerHeight( true );
248248
});
249249
if ( overflow ) {
250250
parent.css( "overflow", overflow );
@@ -437,7 +437,7 @@ $.extend( $.ui.accordion, {
437437
options.prevHide.stop( true, true );
438438
options.toHide = options.prevShow;
439439
}
440-
440+
441441
var showOverflow = options.toShow.css( "overflow" ),
442442
hideOverflow = options.toHide.css( "overflow" ),
443443
percentDone = 0,
@@ -449,7 +449,7 @@ $.extend( $.ui.accordion, {
449449
easing: "swing",
450450
duration: 300
451451
}, options, additions );
452-
452+
453453
options.widget.lastToggle = options;
454454

455455
if ( !options.toHide.size() ) {

ui/jquery.ui.autocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ $.widget( "ui.autocomplete", {
291291
},
292292

293293
_setOption: function( key, value ) {
294-
this._super( "_setOption", key, value );
294+
this._super( key, value );
295295
if ( key === "source" ) {
296296
this._initSource();
297297
}

ui/jquery.ui.button.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ $.widget( "ui.button", {
269269
},
270270

271271
_setOption: function( key, value ) {
272-
this._super( "_setOption", key, value );
272+
this._super( key, value );
273273
if ( key === "disabled" ) {
274274
if ( value ) {
275275
this.element.prop( "disabled", true );
@@ -326,7 +326,7 @@ $.widget( "ui.button", {
326326
.text(),
327327
icons = this.options.icons,
328328
multipleIcons = icons.primary && icons.secondary,
329-
buttonClasses = [];
329+
buttonClasses = [];
330330

331331
if ( icons.primary || icons.secondary ) {
332332
if ( this.options.text ) {
@@ -365,7 +365,7 @@ $.widget( "ui.buttonset", {
365365
_create: function() {
366366
this.element.addClass( "ui-buttonset" );
367367
},
368-
368+
369369
_init: function() {
370370
this.refresh();
371371
},
@@ -375,12 +375,12 @@ $.widget( "ui.buttonset", {
375375
this.buttons.button( "option", key, value );
376376
}
377377

378-
this._super( "_setOption", key, value );
378+
this._super( key, value );
379379
},
380-
380+
381381
refresh: function() {
382382
var rtl = this.element.css( "direction" ) === "rtl";
383-
383+
384384
this.buttons = this.element.find( this.options.items )
385385
.filter( ":ui-button" )
386386
.button( "refresh" )

ui/jquery.ui.dialog.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ $.widget("ui.dialog", {
169169

170170
_destroy: function() {
171171
var self = this;
172-
172+
173173
if ( self.overlay ) {
174174
self.overlay.destroy();
175175
}
@@ -196,7 +196,7 @@ $.widget("ui.dialog", {
196196

197197
var self = this,
198198
maxZ, thisZ;
199-
199+
200200
if ( false === self._trigger( "beforeClose", event ) ) {
201201
return;
202202
}
@@ -493,7 +493,7 @@ $.widget("ui.dialog", {
493493
at: myAt.join( " " ),
494494
offset: offset.join( " " )
495495
};
496-
}
496+
}
497497

498498
position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
499499
} else {
@@ -518,7 +518,7 @@ $.widget("ui.dialog", {
518518

519519
$.each( options, function( key, value ) {
520520
self._setOption( key, value );
521-
521+
522522
if ( key in sizeRelatedOptions ) {
523523
resize = true;
524524
}
@@ -564,7 +564,7 @@ $.widget("ui.dialog", {
564564
if ( isDraggable && !value ) {
565565
uiDialog.draggable( "destroy" );
566566
}
567-
567+
568568
if ( !isDraggable && value ) {
569569
self._makeDraggable();
570570
}
@@ -596,7 +596,7 @@ $.widget("ui.dialog", {
596596
break;
597597
}
598598

599-
this._super( "_setOption", key, value );
599+
this._super( key, value );
600600
},
601601

602602
_size: function() {
@@ -627,7 +627,7 @@ $.widget("ui.dialog", {
627627
})
628628
.height();
629629
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
630-
630+
631631
if ( options.height === "auto" ) {
632632
// only needed for IE6 support
633633
if ( $.support.minHeight ) {
@@ -704,7 +704,7 @@ $.extend( $.ui.dialog.overlay, {
704704
$( document ).bind( "keydown.dialog-overlay", function( event ) {
705705
if ( dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
706706
event.keyCode === $.ui.keyCode.ESCAPE ) {
707-
707+
708708
dialog.close( event );
709709
event.preventDefault();
710710
}

ui/jquery.ui.progressbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $.widget( "ui.progressbar", {
6868
}
6969
}
7070

71-
this._super( "_setOption", key, value );
71+
this._super( key, value );
7272
},
7373

7474
_value: function() {

ui/jquery.ui.spinner.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ $.widget( "ui.spinner", {
318318
return;
319319
}
320320

321-
this._super( "_setOption", key, value );
321+
this._super( key, value );
322322

323323
if ( key === "disabled" ) {
324324
if ( value ) {
@@ -332,7 +332,7 @@ $.widget( "ui.spinner", {
332332
},
333333

334334
_setOptions: modifier(function( options ) {
335-
this._super( "_setOptions", options );
335+
this._super( options );
336336
this._value( this.element.val() );
337337
}),
338338

@@ -387,7 +387,7 @@ $.widget( "ui.spinner", {
387387
.removeAttr( "aria-valuemin" )
388388
.removeAttr( "aria-valuemax" )
389389
.removeAttr( "aria-valuenow" );
390-
this._super( "destroy" );
390+
this._super();
391391
this.uiSpinner.replaceWith( this.element );
392392
},
393393

ui/jquery.ui.tabs.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ $.widget( "ui.tabs", {
136136
return;
137137
}
138138

139-
this._super( "_setOption", key, value);
139+
this._super( key, value);
140140

141141
// setting collapsible: false while collapsed; open first panel
142142
if ( key === "collapsible" && !value && this.options.active === false ) {
@@ -323,7 +323,7 @@ $.widget( "ui.tabs", {
323323

324324
if ( tab.hasClass( "ui-state-disabled" ) ||
325325
// tab is already loading
326-
tab.hasClass( "ui-tabs-loading" ) ||
326+
tab.hasClass( "ui-tabs-loading" ) ||
327327
// can't switch durning an animation
328328
that.running ||
329329
// click on active header, but not collapsible
@@ -555,9 +555,9 @@ $.widget( "ui.tabs", {
555555
if ( status === "abort" ) {
556556
self.panels.stop( false, true );
557557
}
558-
558+
559559
self.lis.eq( index ).removeClass( "ui-tabs-loading" );
560-
560+
561561
if ( jqXHR === self.xhr ) {
562562
delete self.xhr;
563563
}
@@ -674,13 +674,13 @@ if ( $.uiBackCompat !== false ) {
674674
spinner: "<em>Loading&#8230;</em>"
675675
},
676676
_create: function() {
677-
this._super( "_create" );
677+
this._super();
678678
this._bind({
679679
tabsbeforeload: function( event, ui ) {
680680
if ( !this.options.spinner ) {
681681
return;
682682
}
683-
683+
684684
var span = ui.tab.find( "span" ),
685685
html = span.html();
686686
span.html( this.options.spinner );
@@ -973,7 +973,7 @@ if ( $.uiBackCompat !== false ) {
973973
}
974974
options.active = active;
975975
}
976-
this._super( "_create" );
976+
this._super();
977977
},
978978
_cookie: function( active ) {
979979
var cookie = [ this.cookie ||
@@ -985,19 +985,19 @@ if ( $.uiBackCompat !== false ) {
985985
return $.cookie.apply( null, cookie );
986986
},
987987
_refresh: function() {
988-
this._super( "_refresh" );
988+
this._super();
989989
if ( this.options.cookie ) {
990990
this._cookie( this.options.active, this.options.cookie );
991991
}
992992
},
993993
_eventHandler: function( event ) {
994-
this._superApply( "_eventHandler", arguments );
994+
this._superApply( arguments );
995995
if ( this.options.cookie ) {
996996
this._cookie( this.options.active, this.options.cookie );
997997
}
998998
},
999999
_destroy: function() {
1000-
this._super( "_destroy" );
1000+
this._super();
10011001
if ( this.options.cookie ) {
10021002
this._cookie( null, this.options.cookie );
10031003
}
@@ -1012,7 +1012,7 @@ if ( $.uiBackCompat !== false ) {
10121012
_data.panel = _data.panel[ 0 ];
10131013
_data.tab = _data.tab[ 0 ];
10141014
}
1015-
return this._super( "_trigger", type, event, _data );
1015+
return this._super( type, event, _data );
10161016
}
10171017
});
10181018
}

ui/jquery.ui.tooltip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ $.widget( "ui.tooltip", {
5454
// disable element style changes
5555
return;
5656
}
57-
this._super( "_setOption", key, value );
57+
this._super( key, value );
5858
},
5959

6060
_disable: function() {

ui/jquery.ui.widget.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ $.widget = function( name, base, prototype ) {
6262
$.each( prototype, function( prop, value ) {
6363
if ( $.isFunction( value ) ) {
6464
prototype[ prop ] = (function() {
65-
var _super = function( method ) {
66-
return base.prototype[ method ].apply( this, slice.call( arguments, 1 ) );
65+
var _super = function() {
66+
return base.prototype[ prop ].apply( this, arguments );
6767
};
68-
var _superApply = function( method, args ) {
69-
return base.prototype[ method ].apply( this, args );
68+
var _superApply = function( args ) {
69+
return base.prototype[ prop ].apply( this, args );
7070
};
7171
return function() {
7272
var __super = this._super,

0 commit comments

Comments
 (0)