| OLD | NEW |
| (Empty) |
| 1 description( | |
| 2 "This test checks some DOM Range exceptions." | |
| 3 ); | |
| 4 | |
| 5 // Test to be sure the name BAD_BOUNDARYPOINTS_ERR dumps properly. | |
| 6 var node = document.createElement("DIV"); | |
| 7 node.innerHTML = "<BAR>AB<MOO>C</MOO>DE</BAR>"; | |
| 8 shouldBe("node.innerHTML", "'<bar>AB<moo>C</moo>DE</bar>'"); | |
| 9 | |
| 10 // Ensure that we throw BAD_BOUNDARYPOINTS_ERR when trying to split a comment | |
| 11 // (non-text but character-offset node). (Test adapted from Acid3.) | |
| 12 var c1 = document.createComment("aaaaa"); | |
| 13 node.appendChild(c1); | |
| 14 var c2 = document.createComment("bbbbb"); | |
| 15 node.appendChild(c2); | |
| 16 var r = document.createRange(); | |
| 17 r.setStart(c1, 2); | |
| 18 r.setEnd(c2, 3); | |
| 19 shouldThrow("r.surroundContents(document.createElement('a'))", '"InvalidStateErr
or: Failed to execute \'surroundContents\' on \'Range\': The Range has partially
selected a non-Text node."'); | |
| 20 | |
| 21 // But not when we don't try to split the comment. | |
| 22 r.setStart(c1, 0); | |
| 23 r.setEnd(c1, 5); | |
| 24 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."'); | |
| OLD | NEW |