summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-21 13:50:59 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-21 13:50:59 -0500
commit95bdfc31cee22f24bc3b239751d2d4a416014436 (patch)
treefcd395c2bc5847e9345ab74ff6afc1144b6511e8 /lib
parent6d050ba6131055e85a46b282cb52552c3f6cc440 (diff)
Deal with bizarre IE6 .innerHTML behavior (which eats some <script> tags)
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js15
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") {