| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/range-exceptions.js"></script> | 7 <script> |
| 8 description( |
| 9 "This test checks some DOM Range exceptions." |
| 10 ); |
| 11 |
| 12 // Test to be sure the name BAD_BOUNDARYPOINTS_ERR dumps properly. |
| 13 var node = document.createElement("DIV"); |
| 14 node.innerHTML = "<BAR>AB<MOO>C</MOO>DE</BAR>"; |
| 15 shouldBe("node.innerHTML", "'<bar>AB<moo>C</moo>DE</bar>'"); |
| 16 |
| 17 // Ensure that we throw BAD_BOUNDARYPOINTS_ERR when trying to split a comment |
| 18 // (non-text but character-offset node). (Test adapted from Acid3.) |
| 19 var c1 = document.createComment("aaaaa"); |
| 20 node.appendChild(c1); |
| 21 var c2 = document.createComment("bbbbb"); |
| 22 node.appendChild(c2); |
| 23 var r = document.createRange(); |
| 24 r.setStart(c1, 2); |
| 25 r.setEnd(c2, 3); |
| 26 shouldThrow("r.surroundContents(document.createElement('a'))", '"InvalidStateErr
or: Failed to execute \'surroundContents\' on \'Range\': The Range has partially
selected a non-Text node."'); |
| 27 |
| 28 // But not when we don't try to split the comment. |
| 29 r.setStart(c1, 0); |
| 30 r.setEnd(c1, 5); |
| 31 shouldThrow("r.surroundContents(document.createElement('a'))", '"HierarchyReques
tError: Failed to execute \'surroundContents\' on \'Range\': The node to be inse
rted is a \'A\' node, which may not be inserted here."'); |
| 32 </script> |
| 8 </body> | 33 </body> |
| 9 </html> | 34 </html> |
| OLD | NEW |