Commit fe679e1b authored by hyatt's avatar hyatt
Browse files

Add a table test for comment nodes.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4e410bd7
This page tests whether or not comment nodes disrupt the row index of rows in a table.
Row One
Row two
FAIL: document.getElementById('tr1').rowIndex == 1 should be true but instead is false.
FAIL: document.getElementById('tr2').rowIndex == 2 should be true but instead is false.
FAIL: document.getElementById('tr3').rowIndex == 2 should be true but instead is TypeError: Null value.
<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.layoutTestController)
layoutTestController.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>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment