if (emitMarkup) {
Document doc = DomParser.makeDocument(null, null);
String ns = Namespaces.HTML_NAMESPACE_URI;
Element script = doc.createElementNS(ns, "script");
script.setAttributeNS(ns, "type", "text/javascript");
script.appendChild(doc.createCDATASection(jsOut.toString()));
translatedCode = htmlOut + Nodes.render(
script, asXml ? MarkupRenderMode.XML : MarkupRenderMode.HTML);
} else {
if (!"".equals(htmlOut)) {
throw new RuntimeException("Can't emit HTML to " + output);