HTML and CSS Reference
In-Depth Information
function log(text) {
if (output && typeof output.innerHTML != "undefined") {
output.innerHTML += text;
} else {
try {
if (tddjs.ajax && tddjs.get) {
var id = new Date().getTime();
tddjs.ajax.get("fragment.html?id=" + id, {
success: function (xhr) {
} else {
log("Browser does not support tddjs.ajax.get");
} catch (e) {
log("An exception occured:"+e.message);
As you can see from the test script's log function, I intend to run the tests in
some ancient browsers. The fragment being requested can be seen in Listing 12.39.
Listing 12.39 HTML fragment to be loaded asynchronously
<h1>Remote page</h1>
Hello, I am an HTML fragment and I
was fetched
using <code>XMLHttpRequest</code>
12.5.2 Test Results
Running the tests is mostly a pleasurable experience even though it does teach
us a few things about the code. Perhaps most surprisingly, the test is unsuccess-
ful in Firefox up until version 3.0.x. Even though the Mozilla Developer Center
documentation states that send takes an optional body argument, Firefox 3.0.x
and previous versions will in fact throw an exception if send is called without an
Search WWH ::

Custom Search