Skip to content

Commit 1b9575b

Browse files
kumarmjmgol
authored andcommitted
Core: Deprecate jQuery.isArray
Fixes gh-2961 Closes gh-3278
1 parent 5b4cb0d commit 1b9575b

File tree

13 files changed

+23
-18
lines changed

13 files changed

+23
-18
lines changed

src/attributes/val.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jQuery.fn.extend( {
6262
} else if ( typeof val === "number" ) {
6363
val += "";
6464

65-
} else if ( jQuery.isArray( val ) ) {
65+
} else if ( Array.isArray( val ) ) {
6666
val = jQuery.map( val, function( value ) {
6767
return value == null ? "" : value + "";
6868
} );
@@ -173,7 +173,7 @@ jQuery.extend( {
173173
jQuery.each( [ "radio", "checkbox" ], function() {
174174
jQuery.valHooks[ this ] = {
175175
set: function( elem, value ) {
176-
if ( jQuery.isArray( value ) ) {
176+
if ( Array.isArray( value ) ) {
177177
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
178178
}
179179
}

src/core.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ jQuery.extend = jQuery.fn.extend = function() {
172172

173173
// Recurse if we're merging plain objects or arrays
174174
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
175-
( copyIsArray = jQuery.isArray( copy ) ) ) ) {
175+
( copyIsArray = Array.isArray( copy ) ) ) ) {
176176

177177
if ( copyIsArray ) {
178178
copyIsArray = false;
179-
clone = src && jQuery.isArray( src ) ? src : [];
179+
clone = src && Array.isArray( src ) ? src : [];
180180

181181
} else {
182182
clone = src && jQuery.isPlainObject( src ) ? src : {};
@@ -215,8 +215,6 @@ jQuery.extend( {
215215
return jQuery.type( obj ) === "function";
216216
},
217217

218-
isArray: Array.isArray,
219-
220218
isWindow: function( obj ) {
221219
return obj != null && obj === obj.window;
222220
},

src/css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ jQuery.fn.extend( {
404404
map = {},
405405
i = 0;
406406

407-
if ( jQuery.isArray( name ) ) {
407+
if ( Array.isArray( name ) ) {
408408
styles = getStyles( elem );
409409
len = name.length;
410410

src/data/Data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Data.prototype = {
115115
if ( key !== undefined ) {
116116

117117
// Support array or space separated string of keys
118-
if ( jQuery.isArray( key ) ) {
118+
if ( Array.isArray( key ) ) {
119119

120120
// If key is an array of keys...
121121
// We always set camelCase keys, so remove that.

src/deprecated.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jQuery.fn.extend( {
2525
}
2626
} );
2727

28+
jQuery.isArray = Array.isArray;
2829
jQuery.parseJSON = JSON.parse;
2930

3031
} );

src/effects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function propFilter( props, specialEasing ) {
256256
name = jQuery.camelCase( index );
257257
easing = specialEasing[ name ];
258258
value = props[ index ];
259-
if ( jQuery.isArray( value ) ) {
259+
if ( Array.isArray( value ) ) {
260260
easing = value[ 1 ];
261261
value = props[ index ] = value[ 0 ];
262262
}

src/queue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jQuery.extend( {
1717

1818
// Speed up dequeue by getting out quickly if this is just a lookup
1919
if ( data ) {
20-
if ( !queue || jQuery.isArray( data ) ) {
20+
if ( !queue || Array.isArray( data ) ) {
2121
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
2222
} else {
2323
queue.push( data );

src/serialize.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var
1717
function buildParams( prefix, obj, traditional, add ) {
1818
var name;
1919

20-
if ( jQuery.isArray( obj ) ) {
20+
if ( Array.isArray( obj ) ) {
2121

2222
// Serialize array item.
2323
jQuery.each( obj, function( i, v ) {
@@ -69,7 +69,7 @@ jQuery.param = function( a, traditional ) {
6969
};
7070

7171
// If an array was passed in, assume that it is an array of form elements.
72-
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
72+
if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7373

7474
// Serialize the form elements
7575
jQuery.each( a, function() {
@@ -115,7 +115,7 @@ jQuery.fn.extend( {
115115
return null;
116116
}
117117

118-
if ( jQuery.isArray( val ) ) {
118+
if ( Array.isArray( val ) ) {
119119
return jQuery.map( val, function( val ) {
120120
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
121121
} );

test/data/testinit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ this.ajaxTest = function( title, expect, options ) {
169169
}
170170
options = options || [];
171171
requestOptions = options.requests || options.request || options;
172-
if ( !jQuery.isArray( requestOptions ) ) {
172+
if ( !Array.isArray( requestOptions ) ) {
173173
requestOptions = [ requestOptions ];
174174
}
175175

test/data/testrunner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ QUnit.assert.expectJqData = function( env, elems, key ) {
3535
if ( elems.jquery && elems.toArray ) {
3636
elems = elems.toArray();
3737
}
38-
if ( !supportjQuery.isArray( elems ) ) {
38+
if ( !Array.isArray( elems ) ) {
3939
elems = [ elems ];
4040
}
4141

0 commit comments

Comments
 (0)