mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Make setting context work in older ES3 environments that will use values, named after built-in constructors, for the creation of literals.
Former-commit-id: 981139db2a30f9c69d3e616021f697b8403dee26
This commit is contained in:
@@ -129,7 +129,11 @@
|
|||||||
* @returns {Function} Returns the `lodash` function.
|
* @returns {Function} Returns the `lodash` function.
|
||||||
*/
|
*/
|
||||||
function runInContext(context) {
|
function runInContext(context) {
|
||||||
context = context ? _.defaults({}, context, _.pick(window, contextProps)) : window;
|
// Avoid issues with some ES3 environments that attempt to use values, named
|
||||||
|
// after built-in constructors like `Object`, for the creation of literals.
|
||||||
|
// ES5 clears this up by stating that literals must use built-in constructors.
|
||||||
|
// See http://es5.github.com/#x11.1.5.
|
||||||
|
context = context ? _.defaults(window.Object(), context, _.pick(window, contextProps)) : window;
|
||||||
|
|
||||||
/** Native constructor references */
|
/** Native constructor references */
|
||||||
var Array = context.Array,
|
var Array = context.Array,
|
||||||
|
|||||||
Reference in New Issue
Block a user