OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Test for Range.compareNode()</title> | 3 <title>Test for Range.compareNode()</title> |
4 <script> | 4 <script> |
5 function test() | 5 function test() |
6 { | 6 { |
7 // This method returns one of the following constants: | 7 // This method returns one of the following constants: |
8 // Node starts before the Range ( NODE_BEFORE = 0 ) | 8 // Node starts before the Range ( NODE_BEFORE = 0 ) |
9 // Node starts after the Range ( NODE_AFTER = 1 ) | 9 // Node starts after the Range ( NODE_AFTER = 1 ) |
10 // Node starts before and ends after the Range ( NODE_BEFORE_AND_AFTER = 2 ) | 10 // Node starts before and ends after the Range ( NODE_BEFORE_AND_AFTER = 2 ) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 document.getElementById("test16").innerHTML = "test 16 passed: the n
ode has no parent"; | 145 document.getElementById("test16").innerHTML = "test 16 passed: the n
ode has no parent"; |
146 } else { | 146 } else { |
147 document.getElementById("test16").innerHTML = "<span style=\"color:
red;\">test 16 failed error: " + e.message + "</span>"; | 147 document.getElementById("test16").innerHTML = "<span style=\"color:
red;\">test 16 failed error: " + e.message + "</span>"; |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 // test 17 - range has no parent | 151 // test 17 - range has no parent |
152 try { | 152 try { |
153 range.selectNode(document); | 153 range.selectNode(document); |
154 } catch (e) { | 154 } catch (e) { |
155 if(e.code == RangeException.INVALID_NODE_TYPE_ERR) { | 155 if(e.code == DOMException.INVALID_NODE_TYPE_ERR) { |
156 document.getElementById("test17").innerHTML = "test 17 passed: the r
ange has no parent"; | 156 document.getElementById("test17").innerHTML = "test 17 passed: the r
ange has no parent"; |
157 } else { | 157 } else { |
158 document.getElementById("test17").innerHTML = "<span style=\"color:
red;\">test 17 failed error: " + e.message + "\n Code: " + e.code +"</span>"; | 158 document.getElementById("test17").innerHTML = "<span style=\"color:
red;\">test 17 failed error: " + e.message + "\n Code: " + e.code +"</span>"; |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 // test 18 - wrong documents | 162 // test 18 - wrong documents |
163 // firefox does not throw an exception here instead it returns 0 | 163 // firefox does not throw an exception here instead it returns 0 |
164 exptectedResult = 0; | 164 exptectedResult = 0; |
165 var src1 = "<html>\n<head>\n<body>\n<div id=f1>f1</div>\n</body>\n</head>\n<
html>"; | 165 var src1 = "<html>\n<head>\n<body>\n<div id=f1>f1</div>\n</body>\n</head>\n<
html>"; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 <div id=b3>b3</div> | 237 <div id=b3>b3</div> |
238 <div id=c3>c3</div> | 238 <div id=c3>c3</div> |
239 </div> | 239 </div> |
240 | 240 |
241 <iframe name="frame1" style="border: 1px solid black;"></iframe> | 241 <iframe name="frame1" style="border: 1px solid black;"></iframe> |
242 <iframe name="frame2" style="border: 1px solid black;"></iframe> | 242 <iframe name="frame2" style="border: 1px solid black;"></iframe> |
243 </div> | 243 </div> |
244 | 244 |
245 </body> | 245 </body> |
246 </html> | 246 </html> |
OLD | NEW |