diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-11-21 13:50:59 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-11-21 13:50:59 -0500 |
commit | de782f9f8f032913d2213065bd54ba0eae48e488 (patch) | |
tree | fcd395c2bc5847e9345ab74ff6afc1144b6511e8 /lib | |
parent | 7a1666f77ee878a98f770b0d439ceb75f49ff1e2 (diff) |
Deal with bizarre IE6 .innerHTML behavior (which eats some <script> tags)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/urweb.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index ba1e9625..5885143e 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1,3 +1,14 @@ +// Detect browser quirks that we should be aware of. + +function needsDynPrefix() { + var span = document.createElement("span"); + span.innerHTML = "<script>alert('test');</script>"; + var scripts = span.getElementsByTagName("script"); + return scripts.length == 0; +} + +var dynPrefix = needsDynPrefix() ? "<span style=\"display:none\">A</span>" : ""; + // Function versions of operators function not(x) { return !x; } @@ -305,7 +316,7 @@ function runScripts(node) { for (var i = 0; i < len; ++i) { thisScript = scriptsCopy[i]; try { - eval(thisScript.textContent); + eval(thisScript.text); } catch (v) { doExn(v); } @@ -356,7 +367,7 @@ function dyn(pnode, s) { } var cls = {v : null}; - var html = flatten(cls, v); + var html = dynPrefix + flatten(cls, v); x.closures = cls.v; if (pnode == "table") { |