diff options
author | David A. Madore <david+git@madore.org> | 2024-01-01 17:14:26 +0100 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2024-01-01 17:14:26 +0100 |
commit | 1b94f23ab320f1c723b25a46a51484c122c85d66 (patch) | |
tree | a0fb2f763528d203603f9d946ef65de5b7101e40 /org/madore/damlengine | |
parent | 48c94cb368affe9142097a7b895da0dcd9ccb7dd (diff) | |
download | damlengine-1b94f23ab320f1c723b25a46a51484c122c85d66.tar.gz damlengine-1b94f23ab320f1c723b25a46a51484c122c85d66.tar.bz2 damlengine-1b94f23ab320f1c723b25a46a51484c122c85d66.zip |
Call an onEarly() function as soon as <body> is created.
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r-- | org/madore/damlengine/TodoDamlElement.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java index f5b4a7f..7cd94e3 100644 --- a/org/madore/damlengine/TodoDamlElement.java +++ b/org/madore/damlengine/TodoDamlElement.java @@ -58,7 +58,12 @@ public final class TodoDamlElement extends TodoDefaultElement { Element bodyNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "body"); htmlNode.appendChild(bodyNode); htmlNode.appendChild(ctx.doc.createTextNode("\n")); - bodyNode.setAttributeNS(null, "onload", "onLoad()"); + bodyNode.setAttributeNS(null, "onload", "if (onLoad) { onLoad(); }"); + Element earlyScript = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "script"); + earlyScript.setAttributeNS(null, "type", "text/javascript"); + earlyScript.appendChild(ctx.doc.createTextNode("if (onEarly) { onEarly(); }")); + bodyNode.appendChild(ctx.doc.createTextNode("\n")); + bodyNode.appendChild(earlyScript); ctx.gc.styleContent = new StringBuffer(); try { |