Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #8 from aborjinos/patch-1

Access to global object in ES3, ES5 and ES5-strict with partial eval.
  • Loading branch information...
commit 9bff15b1bdf7baf519f5b0925fc515b2994111b9 2 parents d72614c + 4b2ff7c
@shichuan shichuan authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 general-patterns/access-to-global-object.html
View
4 general-patterns/access-to-global-object.html
@@ -7,9 +7,9 @@
<body>
<script>
// access to the Global Object
-// no longer the case in ECMAScript 5 in strict mode
+// this should work in ES3, ES5 and ES5-strict.
var global = (function () {
- return this;
+ return this || (1,eval)('this');
}());
// reference
Please sign in to comment.
Something went wrong with that request. Please try again.