OLD | NEW |
1 description( | 1 description( |
2 "This test checks the behavior of the intersectsNode() method on the Range objec
t.<br>" + | 2 "This test checks the behavior of the intersectsNode() method on the Range objec
t.<br>" + |
3 "It covers all configurations of the node/Range relationship and some exception
conditions." | 3 "It covers all configurations of the node/Range relationship and some exception
conditions." |
4 ); | 4 ); |
5 | 5 |
6 var range = document.createRange(); | 6 var range = document.createRange(); |
7 var intersects = 0; | 7 var intersects = 0; |
8 | 8 |
9 debug("1.1 Node starts before the range and ends before the range"); | 9 debug("1.1 Node starts before the range and ends before the range"); |
10 range.selectNode(document.getElementById("a2")); | 10 range.selectNode(document.getElementById("a2")); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // firefox does not throw an exception but returns 0 | 102 // firefox does not throw an exception but returns 0 |
103 range.selectNode(document.getElementById("a1")); | 103 range.selectNode(document.getElementById("a1")); |
104 var node = document.getElementById("b1"); | 104 var node = document.getElementById("b1"); |
105 node.parentNode.removeChild(node); | 105 node.parentNode.removeChild(node); |
106 intersects = range.intersectsNode(node); | 106 intersects = range.intersectsNode(node); |
107 shouldBeFalse("intersects"); | 107 shouldBeFalse("intersects"); |
108 debug(""); | 108 debug(""); |
109 | 109 |
110 debug("2.3 Node has no parent"); | 110 debug("2.3 Node has no parent"); |
111 range.selectNode(document.getElementById("a2")); | 111 range.selectNode(document.getElementById("a2")); |
112 shouldThrow("range.intersectsNode(document)"); | 112 intersects = range.intersectsNode(document); |
| 113 shouldBeTrue("intersects"); |
113 debug(""); | 114 debug(""); |
114 | 115 |
115 debug("2.4 Range has no parent"); | 116 debug("2.4 Range has no parent"); |
116 shouldThrow("range.selectNode(document)", '"InvalidNodeTypeError: Failed to exec
ute \'selectNode\' on \'Range\': the given Node has no parent."'); | 117 shouldThrow("range.selectNode(document)", '"InvalidNodeTypeError: Failed to exec
ute \'selectNode\' on \'Range\': the given Node has no parent."'); |
117 debug(""); | 118 debug(""); |
118 | 119 |
119 debug("2.5 Wrong documents"); | 120 debug("2.5 Wrong documents"); |
120 // firefox does not throw an exception here instead it returns 0 | 121 // firefox does not throw an exception here instead it returns 0 |
121 var src1 = "<html>\n<head>\n<body>\n<div id=f1>f1</div>\n</body>\n</head>\n<html
>"; | 122 var src1 = "<html>\n<head>\n<body>\n<div id=f1>f1</div>\n</body>\n</head>\n<html
>"; |
122 window.frames['frame1'].document.open("text/html", "replace"); | 123 window.frames['frame1'].document.open("text/html", "replace"); |
(...skipping 14 matching lines...) Expand all Loading... |
137 debug(""); | 138 debug(""); |
138 | 139 |
139 debug("2.6 Node deleted"); | 140 debug("2.6 Node deleted"); |
140 range.selectNode(document.getElementById("a2")); | 141 range.selectNode(document.getElementById("a2")); |
141 var node = null; | 142 var node = null; |
142 shouldThrow("range.intersectsNode(node)"); | 143 shouldThrow("range.intersectsNode(node)"); |
143 debug(""); | 144 debug(""); |
144 | 145 |
145 if (window.testRunner) | 146 if (window.testRunner) |
146 testRunner.dumpAsText(); | 147 testRunner.dumpAsText(); |
OLD | NEW |