aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2011-09-06 13:59:27 -0700
committerIgor Minar2011-09-06 14:58:39 -0700
commit2d489ff936391d3d0b7269009c3737794cb80eab (patch)
treed54269d8125ac3082897c45acf4b44dce1dbfa13
parentfc5cda2f7296de5cd52a44bd1ced31c46f8a3a34 (diff)
downloadangular.js-2d489ff936391d3d0b7269009c3737794cb80eab.tar.bz2
fix(docs): use window.execScript instead of window.eval on IE
IE's window.eval doesn't execute in the global context, so we have to use window.execScript instead which works like window.eval on normal browsers. However execScript throws an exception when an empty string is passed in, so I created a workaround with a workaround.
-rw-r--r--docs/src/templates/doc_widgets.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js
index 277f9a51..17284a1d 100644
--- a/docs/src/templates/doc_widgets.js
+++ b/docs/src/templates/doc_widgets.js
@@ -56,8 +56,13 @@
element.append(tabs);
var script = (exampleSrc.match(/<script[^\>]*>([\s\S]*)<\/script>/) || [])[1] || '';
+
try {
- window.eval(script);
+ if (window.execScript) { // IE
+ window.execScript(script || '"stupid IE!"'); // IE complains when evaling empty string
+ } else {
+ window.eval(script);
+ }
} catch (e) {
alert(e);
}