hyatt | fe679e1 | 2007-05-24 05:58:11 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <script> |
| 4 | function print(message, color) |
| 5 | { |
| 6 | var paragraph = document.createElement("div"); |
| 7 | paragraph.appendChild(document.createTextNode(message)); |
| 8 | paragraph.style.fontFamily = "monospace"; |
| 9 | if (color) |
| 10 | paragraph.style.color = color; |
| 11 | document.getElementById("console").appendChild(paragraph); |
| 12 | } |
| 13 | |
| 14 | function shouldBe(a, b) |
| 15 | { |
| 16 | var evalA; |
| 17 | try { |
| 18 | evalA = eval(a); |
| 19 | } catch(e) { |
| 20 | evalA = e; |
| 21 | } |
| 22 | |
| 23 | if (evalA == b) |
| 24 | print("PASS: " + a + " should be " + b + " and is.", "green"); |
| 25 | else |
| 26 | print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red"); |
| 27 | } |
| 28 | |
| 29 | function test() |
| 30 | { |
rniwa@webkit.org | 224c8b5 | 2012-08-04 01:13:22 +0000 | [diff] [blame] | 31 | if (window.testRunner) |
| 32 | testRunner.dumpAsText(); |
hyatt | fe679e1 | 2007-05-24 05:58:11 +0000 | [diff] [blame] | 33 | |
| 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); |
| 39 | } |
| 40 | </script> |
| 41 | </head> |
| 42 | |
| 43 | <body onload="test();" style="background: green; color:white"> |
| 44 | |
| 45 | <p>This page tests whether or not comment nodes disrupt the row index of |
| 46 | rows in a table.</p> |
| 47 | |
| 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> |
| 49 | |
| 50 | <hr> |
| 51 | |
| 52 | <div id='console' style="background-color:white; border:2px solid black"></div> |
| 53 | |
| 54 | </body> |
| 55 | </html> |