} else if ( typeof val === "number" ) {
val += "";
- } else if ( jQuery.isArray( val ) ) {
+ } else if ( Array.isArray( val ) ) {
val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
} );
jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
+ if ( Array.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
}
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
- ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
+ ( copyIsArray = Array.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
- clone = src && jQuery.isArray( src ) ? src : [];
+ clone = src && Array.isArray( src ) ? src : [];
} else {
clone = src && jQuery.isPlainObject( src ) ? src : {};
return jQuery.type( obj ) === "function";
},
- isArray: Array.isArray,
-
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
map = {},
i = 0;
- if ( jQuery.isArray( name ) ) {
+ if ( Array.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
if ( key !== undefined ) {
// Support array or space separated string of keys
- if ( jQuery.isArray( key ) ) {
+ if ( Array.isArray( key ) ) {
// If key is an array of keys...
// We always set camelCase keys, so remove that.
}
} );
+jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
} );
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
- if ( jQuery.isArray( value ) ) {
+ if ( Array.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
- if ( !queue || jQuery.isArray( data ) ) {
+ if ( !queue || Array.isArray( data ) ) {
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
function buildParams( prefix, obj, traditional, add ) {
var name;
- if ( jQuery.isArray( obj ) ) {
+ if ( Array.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
};
// If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
return null;
}
- if ( jQuery.isArray( val ) ) {
+ if ( Array.isArray( val ) ) {
return jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} );
}
options = options || [];
requestOptions = options.requests || options.request || options;
- if ( !jQuery.isArray( requestOptions ) ) {
+ if ( !Array.isArray( requestOptions ) ) {
requestOptions = [ requestOptions ];
}
if ( elems.jquery && elems.toArray ) {
elems = elems.toArray();
}
- if ( !supportjQuery.isArray( elems ) ) {
+ if ( !Array.isArray( elems ) ) {
elems = [ elems ];
}
assert.ok( jQuery.extend( true, {}, nestedarray )[ "arr" ] !== arr, "Deep extend of object must clone child array" );
// #5991
- assert.ok( jQuery.isArray( jQuery.extend( true, { "arr": {} }, nestedarray )[ "arr" ] ), "Cloned array have to be an Array" );
+ assert.ok( Array.isArray( jQuery.extend( true, { "arr": {} }, nestedarray )[ "arr" ] ), "Cloned array have to be an Array" );
assert.ok( jQuery.isPlainObject( jQuery.extend( true, { "arr": arr }, { "arr": {} } )[ "arr" ] ), "Cloned object have to be an plain object" );
empty = {};
result = jQuery.extend( true, {}, initial );
assert.deepEqual( result, initial, "The [result] and [initial] have equal shape and values" );
- assert.ok( !jQuery.isArray( result.object ), "result.object wasn't paved with an empty array" );
+ assert.ok( !Array.isArray( result.object ), "result.object wasn't paved with an empty array" );
} );
QUnit.test( "jQuery.each(Object,Function)", function( assert ) {
assert.strictEqual( jQuery.parseJSON( [ 0 ] ), 0, "Input cast to string" );
} );
+
+QUnit.test( "jQuery.isArray", function( assert ) {
+ assert.expect( 1 );
+
+ assert.strictEqual( jQuery.isArray, Array.isArray, "Array.isArray equals jQuery.isArray" );
+} );
var div = document.createElement( "div" );
- assert.ok( jQuery.isArray( jQuery.queue( div, "fx", jQuery.noop ) ), "jQuery.queue should return an array while manipulating the queue" );
+ assert.ok( Array.isArray( jQuery.queue( div, "fx", jQuery.noop ) ), "jQuery.queue should return an array while manipulating the queue" );
} );
QUnit.test( "delay()", function( assert ) {