4 function print(message
, color
)
6 var paragraph
= document
.createElement("div");
7 paragraph
.appendChild(document
.createTextNode(message
));
8 paragraph
.style
.fontFamily
= "monospace";
10 paragraph
.style
.color
= color
;
11 document
.getElementById("console").appendChild(paragraph
);
14 function shouldBe(a
, b
)
24 print("PASS: " + a
+ " should be " + b
+ " and is.", "green");
26 print("FAIL: " + a
+ " should be " + b
+ " but instead is " + evalA
+ ".", "red");
31 if (window
.testRunner
)
32 testRunner
.dumpAsText();
34 shouldBe("document.getElementById('tr1').parentNode.childNodes.length == 5", true);
35 shouldBe("document.getElementById('tr1').rowIndex == 0", true);
36 shouldBe("document.getElementById('tr2').rowIndex == 1", true);
37 document
.getElementById('tr2').parentNode
.deleteRow(1);
38 shouldBe("document.getElementById('tr3').rowIndex == 1", true);
43 <body onload=
"test();" style=
"background: green; color:white">
45 <p>This page tests whether or not comment nodes disrupt the row index of
48 <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>
52 <div id='console'
style=
"background-color:white; border:2px solid black"></div>