aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorAhmed.S.ElAfifi <ahmed.s.elafifi@gmail.com>2019-08-19 10:04:01 +0200
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-09-25 01:38:21 +0200
commit9df4f1de12728b44a4b0f91748f12421008d9079 (patch)
treea8864c22790c5045db115c789af5dfecebeb6a02 /src/core.js
parentaa6344baf87145ffc807a527d9c1fb03c96b1948 (diff)
downloadjquery-9df4f1de12728b44a4b0f91748f12421008d9079.tar.gz
jquery-9df4f1de12728b44a4b0f91748f12421008d9079.zip
Core: Use Array.prototype.flat where supported
Calling `Array.prototype.concat.apply( [], inputArray )` to flatten `inputArray` crashes for large arrays; using `Array.prototype.flat` avoids these issues in browsers that support it. In case it's necessary to support these large arrays even in older browsers, a polyfill for `Array.prototype.flat` can be loaded. This is already being done by many applications. Fixes gh-4320 Closes gh-4459
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core.js b/src/core.js
index 0999da9f5..af5d44214 100644
--- a/src/core.js
+++ b/src/core.js
@@ -6,7 +6,7 @@ define( [
"./var/arr",
"./var/getProto",
"./var/slice",
- "./var/concat",
+ "./var/flat",
"./var/push",
"./var/indexOf",
"./var/class2type",
@@ -18,7 +18,7 @@ define( [
"./var/isWindow",
"./core/DOMEval",
"./core/toType"
-], function( arr, getProto, slice, concat, push, indexOf,
+], function( arr, getProto, slice, flat, push, indexOf,
class2type, toString, hasOwn, fnToString, ObjectFunctionString,
support, isWindow, DOMEval, toType ) {
@@ -397,7 +397,7 @@ jQuery.extend( {
}
// Flatten any nested arrays
- return concat.apply( [], ret );
+ return flat( ret );
},
// A global GUID counter for objects