Hi,
I've built a Table of Contents generator in JavaScript for the documentation we're producing here but have encountered broken output when formatting the output using Prince -- but only in XHTML mode.
If I run an unmodified copy of the Automatic TOC script (from the Scripts, Tips & Tricks forum) in XHTML mode then its generated table of contents also shows the problem:
In both cases the output is correct as expected when processed in HTML mode.
I've reduced my code down to a simplified test case. In my tests this shows no content at all in XHTML mode, but formats as expected in HTML mode:
Are there any known problems or gotchas when inserting content using JavaScript in XHTML mode, or have I hit a genuine bug?
Regards,
Dave
I've built a Table of Contents generator in JavaScript for the documentation we're producing here but have encountered broken output when formatting the output using Prince -- but only in XHTML mode.
If I run an unmodified copy of the Automatic TOC script (from the Scripts, Tips & Tricks forum) in XHTML mode then its generated table of contents also shows the problem:
In both cases the output is correct as expected when processed in HTML mode.
I've reduced my code down to a simplified test case. In my tests this shows no content at all in XHTML mode, but formats as expected in HTML mode:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>strict</title>
<script type="text/javascript">
function build(id)
{
var ul = document.createElement("ul");
document.getElementById("toc").appendChild(ul);
var li = document.createElement("li");
ul.appendChild(li);
var a = document.createElement("a");
li.appendChild(a);
var text = document.createTextNode("one");
a.appendChild(text);
var li = document.createElement("li");
ul.appendChild(li);
var a = document.createElement("a");
li.appendChild(a);
var text = document.createTextNode("two");
a.appendChild(text);
var text = document.createTextNode("lots");
document.getElementById("toc").appendChild(text);
}
</script>
</head>
<body onLoad="build('toc')">
<div id="toc">
<h1>Table of Contents</h1>
</div>
<div>
<h1>Another div</h1>
</div>
</body>
</html>
Are there any known problems or gotchas when inserting content using JavaScript in XHTML mode, or have I hit a genuine bug?
Regards,
Dave