OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Test for Range.comparePoint()</title> | 3 <title>Test for Range.comparePoint()</title> |
4 <script> | 4 <script> |
5 function test() | 5 function test() |
6 { | 6 { |
7 // comparePoint( refNode, offset ) - This method returns Ð1, 0 or 1 dependin
g on | 7 // comparePoint( refNode, offset ) - This method returns Ð1, 0 or 1 dependin
g on |
8 // if the point described by the refNode node and an offset within the node
is | 8 // if the point described by the refNode node and an offset within the node
is |
9 // before, same as, or after the range respectively. | 9 // before, same as, or after the range respectively. |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // test 10 - attached range, detached node | 71 // test 10 - attached range, detached node |
72 // firefox throws an exception | 72 // firefox throws an exception |
73 range.selectNode(document.getElementById("a1")); | 73 range.selectNode(document.getElementById("a1")); |
74 var node = document.getElementById("b1"); | 74 var node = document.getElementById("b1"); |
75 node.parentNode.removeChild(node); | 75 node.parentNode.removeChild(node); |
76 try { | 76 try { |
77 range.comparePoint(node, 0); | 77 range.comparePoint(node, 0); |
78 } catch (e) { | 78 } catch (e) { |
79 document.getElementById("test10").innerHTML = "test 10 passed"; | 79 document.getElementById("test10").innerHTML = "test 10 passed"; |
80 } | 80 } |
81 | 81 |
| 82 // test 11 - should throw TypeError when node is not an object |
| 83 try { |
| 84 range.comparePoint(null, 0); |
| 85 } catch (e) { |
| 86 if (e.name == 'TypeError') |
| 87 document.getElementById("test11").innerHTML = "test 11 passed"; |
| 88 } |
| 89 |
82 if (window.testRunner) | 90 if (window.testRunner) |
83 testRunner.dumpAsText(); | 91 testRunner.dumpAsText(); |
84 } | 92 } |
85 | 93 |
86 </script> | 94 </script> |
87 </head> | 95 </head> |
88 <body onload="test();"> | 96 <body onload="test();"> |
89 | 97 |
90 <!-- visible area with test results --> | 98 <!-- visible area with test results --> |
91 <div id=test1><span style="color: red;">test 1 failed</span></div><br> | 99 <div id=test1><span style="color: red;">test 1 failed</span></div><br> |
92 <div id=test2><span style="color: red;">test 2 failed</span></div><br> | 100 <div id=test2><span style="color: red;">test 2 failed</span></div><br> |
93 <div id=test3><span style="color: red;">test 3 failed</span></div><br> | 101 <div id=test3><span style="color: red;">test 3 failed</span></div><br> |
94 <div id=test4><span style="color: red;">test 4 failed</span></div><br> | 102 <div id=test4><span style="color: red;">test 4 failed</span></div><br> |
95 <div id=test5><span style="color: red;">test 5 failed</span></div><br> | 103 <div id=test5><span style="color: red;">test 5 failed</span></div><br> |
96 <div id=test6><span style="color: red;">test 6 failed</span></div><br> | 104 <div id=test6><span style="color: red;">test 6 failed</span></div><br> |
97 <div id=test7><span style="color: red;">test 7 failed</span></div><br> | 105 <div id=test7><span style="color: red;">test 7 failed</span></div><br> |
98 <div id=test8><span style="color: red;">test 8 failed</span></div><br> | 106 <div id=test8><span style="color: red;">test 8 failed</span></div><br> |
99 <div id=test9><span style="color: red;">test 9 failed</span></div><br> | 107 <div id=test9><span style="color: red;">test 9 failed</span></div><br> |
100 <div id=test10><span style="color: red;">test 10 failed</span></div><br> | 108 <div id=test10><span style="color: red;">test 10 failed</span></div><br> |
| 109 <div id=test11><span style="color: red;">test 11 failed</span></div><br> |
101 | 110 |
102 <!-- hidden area to create the ranges being tested --> | 111 <!-- hidden area to create the ranges being tested --> |
103 <div style="visibility: hidden"> | 112 <div style="visibility: hidden"> |
104 <div id=a1>a1 | 113 <div id=a1>a1 |
105 <div id=b1>b1</div> <div id=c1>c1</div> | 114 <div id=b1>b1</div> <div id=c1>c1</div> |
106 </div> | 115 </div> |
107 | 116 |
108 <div id=a2>a2 | 117 <div id=a2>a2 |
109 <div id=b2>b2</div> <div id=c2>c2</div> | 118 <div id=b2>b2</div> <div id=c2>c2</div> |
110 </div> | 119 </div> |
111 | 120 |
112 <div id=a3>a3 | 121 <div id=a3>a3 |
113 <div id=b3>b3</div> <div id=c3>c3</div> | 122 <div id=b3>b3</div> <div id=c3>c3</div> |
114 </div> | 123 </div> |
115 </div> | 124 </div> |
116 | 125 |
117 </body> | 126 </body> |
118 </html> | 127 </html> |
OLD | NEW |