mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget: Only create _super and _superApply once per method, then assign on every execution.
This commit is contained in:
parent
6096aed0a3
commit
92bae28dea
14
ui/jquery.ui.widget.js
vendored
14
ui/jquery.ui.widget.js
vendored
@ -58,15 +58,19 @@ $.widget = function( name, base, prototype ) {
|
|||||||
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
||||||
$.each( prototype, function( prop, value ) {
|
$.each( prototype, function( prop, value ) {
|
||||||
if ( $.isFunction( value ) ) {
|
if ( $.isFunction( value ) ) {
|
||||||
prototype[ prop ] = function() {
|
prototype[ prop ] = (function() {
|
||||||
this._super = function( method ) {
|
var _super = function( method ) {
|
||||||
return base.prototype[ method ].apply( this, slice.call( arguments, 1 ) );
|
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 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, {
|
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
||||||
|
Loading…
Reference in New Issue
Block a user