<html>
<head>
<script id="first"></script>
<script id="second">
function debug(str) {
var c = document.getElementById('console')
c.appendChild(document.createTextNode(str + '\n'));
}
function print(message, color)
{
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
var element, range, nodeFilter, cssRule, cssPrimitiveValue, cssStyleDeclaration, event;
var originalNodeConstructor;
function shouldBe(a, b)
{
var evalA;
try {
evalA = eval(a);
} catch(e) {
evalA = e;
}
if (evalA == b)
print("PASS: " + a + " should be " + b + " and is.", "green");
else
print("FAIL: " + a + " should be " + b + " but instead is " + evalA, "red");
}
function runTests() {
if (window.testRunner)
testRunner.dumpAsText();
shouldBe(document.scripts.length, 2);
shouldBe("document.scripts[0].id", "first");
shouldBe("document.scripts[1].id", "second");
}
</script>
</head>
<body onload="runTests();">
This tests that document.scripts works correctly.
<pre id="console">
</pre>
</body>
</html>