diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-08-03 08:38:47 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-08-03 08:38:47 -0400 |
commit | e64a27b444ef683356d91f4391f8f8f190053eeb (patch) | |
tree | 5888d6011479244d00fbccba2641b29c4c6e2a03 | |
parent | 921f958c199860d10320b7d2a162fa59bdef5bac (diff) |
Undo change to script evaluation, originally made to support <active> + 'giveFocus'; alternate approach to making 'giveFocus' work in dynamic code generatione
-rw-r--r-- | lib/js/urweb.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 4ef77599..b8ebc1c6 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -815,6 +815,7 @@ function dyn(pnode, s) { var dummy = document.createElement("body"); dummy.innerHTML = "<table>" + html + "</table>"; + runScripts(dummy); var table = x.parentNode; if (table) { @@ -842,12 +843,12 @@ function dyn(pnode, s) { for (var node = tbody.firstChild; node; node = next) { next = node.nextSibling; table.insertBefore(node, x); - runScripts(node); } } } else if (pnode == "tr") { var dummy = document.createElement("body"); dummy.innerHTML = "<table><tr>" + html + "</tr></table>"; + runScripts(dummy); var table = x.parentNode; if (table) { @@ -865,15 +866,14 @@ function dyn(pnode, s) { for (var node = tr.firstChild; node; node = next) { next = node.nextSibling; table.insertBefore(node, x); - runScripts(node); } } } else { firstChild = document.createElement("span"); firstChild.innerHTML = html; + runScripts(firstChild); if (x.parentNode) x.parentNode.insertBefore(firstChild, x); - runScripts(firstChild); } }; @@ -1863,12 +1863,14 @@ function fresh() { } function giveFocus(id) { - var node = document.getElementById(id); + window.setTimeout(function() { + var node = document.getElementById(id); - if (node) - node.focus(); - else - er("Tried to give focus to ID not used in document: " + id); + if (node) + node.focus(); + else + er("Tried to give focus to ID not used in document: " + id); + }, 0); } |