56 lines
1.6 KiB
HTML
56 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<script>
|
|
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);
|
|
}
|
|
|
|
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 test()
|
|
{
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
shouldBe("document.getElementById('tr1').parentNode.childNodes.length == 5", true);
|
|
shouldBe("document.getElementById('tr1').rowIndex == 0", true);
|
|
shouldBe("document.getElementById('tr2').rowIndex == 1", true);
|
|
document.getElementById('tr2').parentNode.deleteRow(1);
|
|
shouldBe("document.getElementById('tr3').rowIndex == 1", true);
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body onload="test();" style="background: green; color:white">
|
|
|
|
<p>This page tests whether or not comment nodes disrupt the row index of
|
|
rows in a table.</p>
|
|
|
|
<table><tr id="tr1"><td>Row One</tr><!-- COMMENT TO TRY TO MESS STUFF UP --><tr id="tr2"><td>Row Two</tr><!-- COMMENT TO TRY TO MESS STUFF UP --><tr id="tr3"><td>Row Three<!-- COMMENT TO TRY TO MESS STUFF UP --></table>
|
|
|
|
<hr>
|
|
|
|
<div id='console' style="background-color:white; border:2px solid black"></div>
|
|
|
|
</body>
|
|
</html>
|