From 9df4f1de12728b44a4b0f91748f12421008d9079 Mon Sep 17 00:00:00 2001 From: "Ahmed.S.ElAfifi" Date: Mon, 19 Aug 2019 10:04:01 +0200 Subject: 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 --- src/core.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core.js') 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 -- cgit v1.2.3