Skip to content
Permalink
Browse files

Widget: Handle super calls when method calls go up and down the inher…

…itance chain.
  • Loading branch information
scottgonzalez committed Feb 11, 2011
1 parent 5b104db commit 1cb1b9cef7cfc4bd77c619f4ee55b5d3fc99419a
Showing with 13 additions and 8 deletions.
  1. +2 −7 ui/jquery.ui.spinner.js
  2. +11 −1 ui/jquery.ui.widget.js
@@ -285,16 +285,11 @@ $.widget('ui.spinner', {
this.buttons.button("enable");
}
}
// TODO see below
//this._super( "_setOption", key, value );
$.Widget.prototype._setOption.apply( this, arguments );
this._super( "_setOption", key, value );
},

_setOptions: function( options ) {
// TODO _super doesn't handle inheritance with more then one subclass
// spinner subclass will have spinner as base, calling spinner._setOptions infinitely
//this._super( "_setOptions", options );
$.Widget.prototype._setOptions.apply( this, arguments );
this._super( "_setOptions", options );
if ( "value" in options ) {
this._format( this.options.value );
}
@@ -66,9 +66,19 @@ $.widget = function( name, base, prototype ) {
return base.prototype[ method ].apply( this, args );
};
return function() {
var __super = this._super,
__superApply = this._superApply,
returnValue;

this._super = _super;
this._superApply = _superApply;
return value.apply( this, arguments );

returnValue = value.apply( this, arguments );

this._super = __super;
this._superApply = __superApply;

return returnValue;
};
}());
}

0 comments on commit 1cb1b9c

Please sign in to comment.
You can’t perform that action at this time.