From 9f2b1b03d7cedeb274377acbbf2c40f52249b2f1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 17 Sep 2013 00:16:40 -0700 Subject: [PATCH] Don't restore `undefined` native methods in test/index.html. --- test/index.html | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/index.html b/test/index.html index 2b0d95557..f3a08618e 100644 --- a/test/index.html +++ b/test/index.html @@ -38,16 +38,26 @@ var lodashBadShim = window._; // restore native methods - Array.isArray = Array._isArray; + delete Array.isArray; + delete Function.prototype.bind; + delete Object.defineProperty; + delete Object.keys; + + if (Array._isArray) { + Array.isArray = Array._isArray; + } + if (Function.prototype._bind) { + Function.prototype.bind = Function.prototype._bind; + } + if (Object._defineProperty) { + Object.defineProperty = Object._defineProperty; + } + if (Object._keys) { + Object.keys = Object._keys; + } delete Array._isArray; - - Function.prototype.bind = Function.prototype._bind; delete Function.prototype._bind; - - Object.defineProperty = Object._defineProperty; delete Object._defineProperty; - - Object.keys = Object._keys; delete Object._keys; // load Lo-Dash again to overwrite the existing `_` value