| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 5 <script> | |
| 6 window.onload = function(){ | |
| 7 var range = document.createRange(); | |
| 8 var rootNode = document.getElementById("root"); | |
| 9 range.setStart(rootNode, 4); | |
| 10 range.setEnd(rootNode, 6); | |
| 11 var parentElement = document.getElementById("targetForSurround"); | |
| 12 range.surroundContents(parentElement); | |
| 13 | |
| 14 shouldBe(range.startContainer.id, rootNode.id); | |
| 15 shouldBe(range.startOffset.toString(), "3"); | |
| 16 shouldBe(range.endContainer.id, rootNode.id); | |
| 17 shouldBe(range.startOffset.toString(), "3"); | |
| 18 }; | |
| 19 </script> | |
| 20 <script src="../../fast/js/resources/js-test-post.js"></script> | |
| 21 <div id="root"> | 5 <div id="root"> |
| 22 <div id="targetForSurround"></div> | 6 <div id="targetForSurround"></div> |
| 23 <div id="description">Test that there is no crash when surroundContents is
called with a node preceding the current selection.</div> | 7 <div id="description">Test that there is no crash when surroundContents is
called with a node preceding the current selection.</div> |
| 24 <div id="trailingNode"></div> | 8 <div id="trailingNode"></div> |
| 25 </div> | 9 </div> |
| 10 <script> |
| 11 var range = document.createRange(); |
| 12 var rootNode = document.getElementById("root"); |
| 13 range.setStart(rootNode, 4); |
| 14 range.setEnd(rootNode, 6); |
| 15 var parentElement = document.getElementById("targetForSurround"); |
| 16 range.surroundContents(parentElement); |
| 17 |
| 18 shouldBe('range.startContainer.id', 'rootNode.id'); |
| 19 shouldBe('range.startOffset', '3'); |
| 20 shouldBe('range.endContainer.id', 'rootNode.id'); |
| 21 shouldBe('range.startOffset', '3'); |
| 22 </script> |
| 23 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 26 </body> | 24 </body> |
| 27 </html> | 25 </html> |
| OLD | NEW |