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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 debug("1.13 Range starts at 0 and ends at 1"); | 88 debug("1.13 Range starts at 0 and ends at 1"); |
89 range.setStart(document.getElementById("b2"), 0); | 89 range.setStart(document.getElementById("b2"), 0); |
90 range.setEnd(document.getElementById("b2"), 1); | 90 range.setEnd(document.getElementById("b2"), 1); |
91 intersects = range.intersectsNode(document.getElementById("b2")); | 91 intersects = range.intersectsNode(document.getElementById("b2")); |
92 shouldBeTrue("intersects"); | 92 shouldBeTrue("intersects"); |
93 debug(""); | 93 debug(""); |
94 | 94 |
95 debug("2.1 Detached Range, attached node"); | 95 debug("2.1 Detached Range, attached node"); |
96 var detachedRange = document.createRange(); | 96 var detachedRange = document.createRange(); |
97 detachedRange.detach(); | 97 detachedRange.detach(); // No-op. |
98 shouldThrow("detachedRange.intersectsNode(document.getElementById('a1'))", '"Inv
alidStateError: Failed to execute \'intersectsNode\' on \'Range\': The range has
no container. Perhaps \'detach()\' has been invoked on this object?"'); | 98 shouldBeFalse("detachedRange.intersectsNode(document.getElementById('a1'))"); |
99 debug(""); | 99 debug(""); |
100 | 100 |
101 debug("2.2 attached range, detached node"); | 101 debug("2.2 attached range, detached node"); |
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(""); |
(...skipping 28 matching lines...) Expand all Loading... |
137 debug(""); | 137 debug(""); |
138 | 138 |
139 debug("2.6 Node deleted"); | 139 debug("2.6 Node deleted"); |
140 range.selectNode(document.getElementById("a2")); | 140 range.selectNode(document.getElementById("a2")); |
141 var node = null; | 141 var node = null; |
142 shouldThrow("range.intersectsNode(node)"); | 142 shouldThrow("range.intersectsNode(node)"); |
143 debug(""); | 143 debug(""); |
144 | 144 |
145 if (window.testRunner) | 145 if (window.testRunner) |
146 testRunner.dumpAsText(); | 146 testRunner.dumpAsText(); |
OLD | NEW |