aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-02-10 21:32:33 -0500
committerScott González <scott.gonzalez@gmail.com>2011-02-10 21:32:33 -0500
commit92bae28deaa6d4ab195b51a46acf5ed3157b7648 (patch)
tree380acefe0394c6bb500b6a26bd28f276b6d1be09 /ui/jquery.ui.widget.js
parent6096aed0a38948fe02a697d0f5349c6903c90e47 (diff)
downloadjquery-ui-92bae28deaa6d4ab195b51a46acf5ed3157b7648.tar.gz
jquery-ui-92bae28deaa6d4ab195b51a46acf5ed3157b7648.zip
Widget: Only create _super and _superApply once per method, then assign on every execution.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 27a7cd1b0..e09701d7b 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -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, {