From 2d489ff936391d3d0b7269009c3737794cb80eab Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 6 Sep 2011 13:59:27 -0700 Subject: 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. --- docs/src/templates/doc_widgets.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'docs/src/templates/doc_widgets.js') 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(/]*>([\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); } -- cgit v1.2.3