]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Handle super calls when method calls go up and down the inheritance chain.
authorScott González <scott.gonzalez@gmail.com>
Fri, 11 Feb 2011 13:53:43 +0000 (08:53 -0500)
committerScott González <scott.gonzalez@gmail.com>
Fri, 11 Feb 2011 13:53:43 +0000 (08:53 -0500)
ui/jquery.ui.spinner.js
ui/jquery.ui.widget.js

index 0219abb8bbf73e2137326e9d44b644facbf01381..6d4d10d5133e25c92ed73d07dfb218c8e8390e88 100644 (file)
@@ -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 );
                }
index e09701d7b8035ac9e008c61528f8712216c2ff67..0a475902393c5cfdeceb2dbdecfb1381216a4938 100644 (file)
@@ -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;
                                };
                        }());
                }