summaryrefslogtreecommitdiff
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/js/urweb.js')
-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") {