]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Only create _super and _superApply once per method, then assign on every...
authorScott González <scott.gonzalez@gmail.com>
Fri, 11 Feb 2011 02:32:33 +0000 (21:32 -0500)
committerScott González <scott.gonzalez@gmail.com>
Fri, 11 Feb 2011 02:32:33 +0000 (21:32 -0500)
ui/jquery.ui.widget.js

index 27a7cd1b09b81a96a14ad6840b73258914b9c3b4..e09701d7b8035ac9e008c61528f8712216c2ff67 100644 (file)
@@ -58,15 +58,19 @@ $.widget = function( name, base, prototype ) {
        basePrototype.options = $.extend( true, {}, basePrototype.options );
        $.each( prototype, function( prop, value ) {
                if ( $.isFunction( value ) ) {
-                       prototype[ prop ] = function() {
-                               this._super = function( method ) {
+                       prototype[ prop ] = (function() {
+                               var _super = function( method ) {
                                        return base.prototype[ method ].apply( this, slice.call( arguments, 1 ) );
                                };
-                               this._superApply = function( method, args ) {
+                               var _superApply = function( method, args ) {
                                        return base.prototype[ method ].apply( this, args );
                                };
-                               return value.apply( this, arguments );
-                       };
+                               return function() {
+                                       this._super = _super;
+                                       this._superApply = _superApply;
+                                       return value.apply( this, arguments );
+                               };
+                       }());
                }
        });
        $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {