| OLD | NEW |
| 1 description( | 1 description( |
| 2 "This test checks some DOM Range exceptions." | 2 "This test checks some DOM Range exceptions." |
| 3 ); | 3 ); |
| 4 | 4 |
| 5 // Test to be sure the name BAD_BOUNDARYPOINTS_ERR dumps properly. | 5 // Test to be sure the name BAD_BOUNDARYPOINTS_ERR dumps properly. |
| 6 var node = document.createElement("DIV"); | 6 var node = document.createElement("DIV"); |
| 7 node.innerHTML = "<BAR>AB<MOO>C</MOO>DE</BAR>"; | 7 node.innerHTML = "<BAR>AB<MOO>C</MOO>DE</BAR>"; |
| 8 shouldBe("node.innerHTML", "'<bar>AB<moo>C</moo>DE</bar>'"); | 8 shouldBe("node.innerHTML", "'<bar>AB<moo>C</moo>DE</bar>'"); |
| 9 var range = document.createRange(); | 9 var range = document.createRange(); |
| 10 range.setStart(node.firstChild, 1); | 10 range.setStart(node.firstChild, 1); |
| 11 range.setEnd(node.firstChild, 2); | 11 range.setEnd(node.firstChild, 2); |
| 12 var foo = document.createElement("FOO"); | 12 var foo = document.createElement("FOO"); |
| 13 shouldBe("foo.outerHTML", "'<foo></foo>'"); | 13 shouldBe("foo.outerHTML", "'<foo></foo>'"); |
| 14 shouldThrow("range.surroundContents(foo)"); | 14 shouldThrow("range.surroundContents(foo)"); |
| 15 | 15 |
| 16 // Ensure that we throw BAD_BOUNDARYPOINTS_ERR when trying to split a comment | 16 // Ensure that we throw BAD_BOUNDARYPOINTS_ERR when trying to split a comment |
| 17 // (non-text but character-offset node). (Test adapted from Acid3.) | 17 // (non-text but character-offset node). (Test adapted from Acid3.) |
| 18 var c1 = document.createComment("aaaaa"); | 18 var c1 = document.createComment("aaaaa"); |
| 19 node.appendChild(c1); | 19 node.appendChild(c1); |
| 20 var c2 = document.createComment("bbbbb"); | 20 var c2 = document.createComment("bbbbb"); |
| 21 node.appendChild(c2); | 21 node.appendChild(c2); |
| 22 var r = document.createRange(); | 22 var r = document.createRange(); |
| 23 r.setStart(c1, 2); | 23 r.setStart(c1, 2); |
| 24 r.setEnd(c2, 3); | 24 r.setEnd(c2, 3); |
| 25 shouldThrow("r.surroundContents(document.createElement('a'))", '"Error: BAD_BOUN
DARYPOINTS_ERR: DOM Range Exception 1"'); | 25 shouldThrow("r.surroundContents(document.createElement('a'))", '"Error: InvalidS
tateError: DOM Exception 11"'); |
| 26 | 26 |
| 27 // But not when we don't try to split the comment. | 27 // But not when we don't try to split the comment. |
| 28 r.setStart(c1, 0); | 28 r.setStart(c1, 0); |
| 29 r.setEnd(c1, 5); | 29 r.setEnd(c1, 5); |
| 30 shouldThrow("r.surroundContents(document.createElement('a'))", '"Error: Hierarch
yRequestError: DOM Exception 3"'); | 30 shouldThrow("r.surroundContents(document.createElement('a'))", '"Error: Hierarch
yRequestError: DOM Exception 3"'); |
| OLD | NEW |