Skip to content

Commit 1cb1b9c

Browse files
committed
Widget: Handle super calls when method calls go up and down the inheritance chain.
1 parent 5b104db commit 1cb1b9c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

ui/jquery.ui.spinner.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,11 @@ $.widget('ui.spinner', {
285285
this.buttons.button("enable");
286286
}
287287
}
288-
// TODO see below
289-
//this._super( "_setOption", key, value );
290-
$.Widget.prototype._setOption.apply( this, arguments );
288+
this._super( "_setOption", key, value );
291289
},
292290

293291
_setOptions: function( options ) {
294-
// TODO _super doesn't handle inheritance with more then one subclass
295-
// spinner subclass will have spinner as base, calling spinner._setOptions infinitely
296-
//this._super( "_setOptions", options );
297-
$.Widget.prototype._setOptions.apply( this, arguments );
292+
this._super( "_setOptions", options );
298293
if ( "value" in options ) {
299294
this._format( this.options.value );
300295
}

ui/jquery.ui.widget.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,19 @@ $.widget = function( name, base, prototype ) {
6666
return base.prototype[ method ].apply( this, args );
6767
};
6868
return function() {
69+
var __super = this._super,
70+
__superApply = this._superApply,
71+
returnValue;
72+
6973
this._super = _super;
7074
this._superApply = _superApply;
71-
return value.apply( this, arguments );
75+
76+
returnValue = value.apply( this, arguments );
77+
78+
this._super = __super;
79+
this._superApply = __superApply;
80+
81+
return returnValue;
7282
};
7383
}());
7484
}

0 commit comments

Comments
 (0)