From a38be80a86bb07db2ffd68e9e3c33f6242291d5b Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 17 Feb 2010 17:37:46 -0800 Subject: [PATCH] Revert "A better fix for the IE bug. Rather than introduce the secondary global and the eval, just refer to the actual global object (works in any javascript env)." This reverts commit d40619aca072134fe41369b161add2d12b1e0a02. --- Objective-J/Browser/Objective-J.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Objective-J/Browser/Objective-J.js b/Objective-J/Browser/Objective-J.js index 733921b60..f2c48c0cf 100644 --- a/Objective-J/Browser/Objective-J.js +++ b/Objective-J/Browser/Objective-J.js @@ -1,8 +1,27 @@ -var ObjectiveJ = { }; +var global = { }, + ObjectiveJ = { }; (function (global, exports, namespace) { + var GLOBAL_NAMESPACE = namespace; #include "Includes.js" -})((function(){return this;}).call(null), ObjectiveJ); +})(global, ObjectiveJ, window); +var hasOwnProperty = Object.prototype.hasOwnProperty; + +// If we can't trust the host object, don't treat it as global +// and fall back to inferred global through eval. In IE this +// make a difference. +if (window.window !== window) +{ + for (key in global) + if (hasOwnProperty.call(global, key)) + eval(key + " = global[\"" + key + "\"];"); +} +else +{ + for (key in global) + if (hasOwnProperty.call(global, key)) + window[key] = global[key]; +}