* @cat Ajax
*/
load: function( url, params, callback, ifModified ) {
- if ( url.constructor == Function )
+ if ( jQuery.isFunction( url ) )
return this.bind("load", url);
callback = callback || function(){};
// If the second parameter was provided
if ( params )
// If it's a function
- if ( params.constructor == Function ) {
+ if ( jQuery.isFunction( params.constructor ) ) {
// We assume that it's the callback
callback = params;
params = null;
*/
get: function( url, data, callback, type, ifModified ) {
// shift arguments if data argument was ommited
- if ( data && data.constructor == Function ) {
+ if ( jQuery.isFunction( data ) ) {
callback = data;
data = null;
}
*/
show: function(speed,callback){
var hidden = this.filter(":hidden");
- speed ?
+ return speed ?
hidden.animate({
height: "show", width: "show", opacity: "show"
}, speed, callback) :
if ( jQuery.css(this,"display") == "none" )
this.style.display = "block";
});
- return this;
},
/**
*/
hide: function(speed,callback){
var visible = this.filter(":visible");
- speed ?
+ return speed ?
visible.animate({
height: "hide", width: "hide", opacity: "hide"
}, speed, callback) :
this.oldblock = "block";
this.style.display = "none";
});
- return this;
},
// Save the old toggle function
*/
toggle: function( fn, fn2 ){
var args = arguments;
- return fn && fn.constructor == Function && fn2 && fn2.constructor == Function ?
+ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
this._toggle( fn, fn2 ) :
this.each(function(){
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]
speed: function(speed, easing, fn) {
var opt = speed && speed.constructor == Object ? speed : {
complete: fn || !fn && easing ||
- speed && speed.constructor == Function && speed,
+ jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && easing.constructor != Function && easing
};
{ slow: 600, fast: 200 }[opt.duration]) || 400;
// Queueing
- opt.oldComplete = opt.complete;
+ opt.old = opt.complete;
opt.complete = function(){
jQuery.dequeue(this, "fx");
- if ( opt.oldComplete && opt.oldComplete.constructor == Function )
- opt.oldComplete.apply( this );
+ if ( jQuery.isFunction( opt.old ) )
+ opt.old.apply( this );
};
return opt;
var y = elem.style;
// Store display property
- var oldDisplay = jQuery.css(elem, 'display');
+ var oldDisplay = jQuery.css(elem, "display");
+
// Set display property to block for animation
y.display = "block";
+
// Make sure that nothing sneaks out
y.overflow = "hidden";
// Remember where we started, so that we can go back to it later
elem.orig[prop] = this.cur();
- if(oldDisplay == 'none') {
+ if(oldDisplay == "none") {
options.show = true;
// Stupid IE, look what you made me do
if ( done ) {
// Reset the overflow
- y.overflow = '';
+ y.overflow = "";
// Reset the display
y.display = oldDisplay;
- if (jQuery.css(elem, 'display') == 'none')
- y.display = 'block';
+ if (jQuery.css(elem, "display") == "none")
+ y.display = "block";
// Hide the element if the "hide" operation was done
if ( options.hide )
- y.display = 'none';
+ y.display = "none";
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show )
if (p == "opacity")
jQuery.attr(y, p, elem.orig[p]);
else
- y[p] = '';
+ y[p] = "";
}
// If a callback was provided, execute it
- if ( done && options.complete && options.complete.constructor == Function )
+ if ( done && jQuery.isFunction( options.complete ) )
// Execute the complete function
options.complete.apply( elem );
} else {
// HANDLE: $(function)
// Shortcut for document ready
// Safari reports typeof on DOM NodeLists as a function
- if ( typeof a == "function" && !a.nodeType && a[0] == undefined )
+ if ( isFunction(a) && !a.nodeType && a[0] == undefined )
return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
// Handle HTML strings
*/
filter: function(t) {
return this.pushStack(
- t.constructor == Function &&
+ isFunction( t.constructor ) &&
jQuery.grep(this, function(el, index){
return t.apply(el, [index])
}) ||
$ = jQuery._$;
},
+ isFunction: function( fn ) {
+ return fn && typeof fn == "function";
+ },
+
/**
* A generic iterator function, which can be used to seemlessly
* iterate over both objects and arrays. This function is not the same
prop: function(elem, value, type){
// Handle executable functions
- if ( value.constructor == Function )
+ if ( isFunction( value ) )
return value.call( elem );
// Handle passing in a number to a CSS property