mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Removed guard against duplicate loading. Use safe references to original functions when proxying, don't rename originals.
This commit is contained in:
parent
cdff72efed
commit
e0b2644d91
36
ui/jquery.ui.core.js
vendored
36
ui/jquery.ui.core.js
vendored
@ -13,13 +13,8 @@
|
||||
var uuid = 0,
|
||||
runiqueId = /^ui-id-\d+$/;
|
||||
|
||||
// prevent duplicate loading
|
||||
// this is only a problem because we proxy existing functions
|
||||
// and we don't want to double proxy them
|
||||
// $.ui might exist from components with no dependencies, e.g., $.ui.position
|
||||
$.ui = $.ui || {};
|
||||
if ( $.ui.version ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.extend( $.ui, {
|
||||
version: "@VERSION",
|
||||
@ -52,20 +47,21 @@ $.extend( $.ui, {
|
||||
|
||||
// plugins
|
||||
$.fn.extend({
|
||||
_focus: $.fn.focus,
|
||||
focus: function( delay, fn ) {
|
||||
return typeof delay === "number" ?
|
||||
this.each(function() {
|
||||
var elem = this;
|
||||
setTimeout(function() {
|
||||
$( elem ).focus();
|
||||
if ( fn ) {
|
||||
fn.call( elem );
|
||||
}
|
||||
}, delay );
|
||||
}) :
|
||||
this._focus.apply( this, arguments );
|
||||
},
|
||||
focus: (function( orig ) {
|
||||
return function( delay, fn ) {
|
||||
return typeof delay === "number" ?
|
||||
this.each(function() {
|
||||
var elem = this;
|
||||
setTimeout(function() {
|
||||
$( elem ).focus();
|
||||
if ( fn ) {
|
||||
fn.call( elem );
|
||||
}
|
||||
}, delay );
|
||||
}) :
|
||||
orig.apply( this, arguments );
|
||||
};
|
||||
})( $.fn.focus ),
|
||||
|
||||
scrollParent: function() {
|
||||
var scrollParent;
|
||||
|
63
ui/jquery.ui.effect.js
vendored
63
ui/jquery.ui.effect.js
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
* http://api.jqueryui.com/category/effects-core/
|
||||
*/
|
||||
;(jQuery.effects || (function($, undefined) {
|
||||
(function($, undefined) {
|
||||
|
||||
var dataSpace = "ui-effects-";
|
||||
|
||||
@ -839,39 +839,42 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
_addClass: $.fn.addClass,
|
||||
addClass: function( classNames, speed, easing, callback ) {
|
||||
return speed ?
|
||||
$.effects.animateClass.call( this,
|
||||
{ add: classNames }, speed, easing, callback ) :
|
||||
this._addClass( classNames );
|
||||
},
|
||||
addClass: (function( orig ) {
|
||||
return function( classNames, speed, easing, callback ) {
|
||||
return speed ?
|
||||
$.effects.animateClass.call( this,
|
||||
{ add: classNames }, speed, easing, callback ) :
|
||||
orig.apply( this, arguments );
|
||||
};
|
||||
})( $.fn.addClass ),
|
||||
|
||||
_removeClass: $.fn.removeClass,
|
||||
removeClass: function( classNames, speed, easing, callback ) {
|
||||
return arguments.length > 1 ?
|
||||
$.effects.animateClass.call( this,
|
||||
{ remove: classNames }, speed, easing, callback ) :
|
||||
this._removeClass.apply( this, arguments );
|
||||
},
|
||||
removeClass: (function( orig ) {
|
||||
return function( classNames, speed, easing, callback ) {
|
||||
return arguments.length > 1 ?
|
||||
$.effects.animateClass.call( this,
|
||||
{ remove: classNames }, speed, easing, callback ) :
|
||||
orig.apply( this, arguments );
|
||||
};
|
||||
})( $.fn.removeClass ),
|
||||
|
||||
_toggleClass: $.fn.toggleClass,
|
||||
toggleClass: function( classNames, force, speed, easing, callback ) {
|
||||
if ( typeof force === "boolean" || force === undefined ) {
|
||||
if ( !speed ) {
|
||||
// without speed parameter
|
||||
return this._toggleClass( classNames, force );
|
||||
toggleClass: (function( orig ) {
|
||||
return function( classNames, force, speed, easing, callback ) {
|
||||
if ( typeof force === "boolean" || force === undefined ) {
|
||||
if ( !speed ) {
|
||||
// without speed parameter
|
||||
return orig.apply( this, arguments );
|
||||
} else {
|
||||
return $.effects.animateClass.call( this,
|
||||
(force ? { add: classNames } : { remove: classNames }),
|
||||
speed, easing, callback );
|
||||
}
|
||||
} else {
|
||||
// without force parameter
|
||||
return $.effects.animateClass.call( this,
|
||||
(force ? { add: classNames } : { remove: classNames }),
|
||||
speed, easing, callback );
|
||||
{ toggle: classNames }, force, speed, easing );
|
||||
}
|
||||
} else {
|
||||
// without force parameter
|
||||
return $.effects.animateClass.call( this,
|
||||
{ toggle: classNames }, force, speed, easing );
|
||||
}
|
||||
},
|
||||
};
|
||||
})( $.fn.toggleClass ),
|
||||
|
||||
switchClass: function( remove, add, speed, easing, callback) {
|
||||
return $.effects.animateClass.call( this, {
|
||||
@ -1283,4 +1286,4 @@ $.each( baseEasings, function( name, easeIn ) {
|
||||
|
||||
})();
|
||||
|
||||
})(jQuery));
|
||||
})(jQuery);
|
||||
|
Loading…
Reference in New Issue
Block a user