OLD | NEW |
1 <p>This tests to see that Range::compareBoundaryPoints throws a WrongDocumentErr
or exception if the two ranges are in different documents, or if one is detached
.</p> | 1 <p>This tests to see that Range::compareBoundaryPoints throws a WrongDocumentErr
or exception if the two ranges are in different documents, or if one is detached
.</p> |
2 <div id="div" contenteditable="true">dog<a href="http://www.google.com/">food</a
></div> | 2 <div id="div" contenteditable="true">dog<a href="http://www.google.com/">food</a
></div> |
3 <ul id="console"></ul> | 3 <ul id="console"></ul> |
4 | 4 |
5 <script> | 5 <script> |
6 function log(str) { | 6 function log(str) { |
7 var console = document.getElementById("console"); | 7 var console = document.getElementById("console"); |
8 var li = document.createElement("li"); | 8 var li = document.createElement("li"); |
9 li.appendChild(document.createTextNode(str)); | 9 li.appendChild(document.createTextNode(str)); |
10 console.appendChild(li); | 10 console.appendChild(li); |
(...skipping 14 matching lines...) Expand all Loading... |
25 r1.setEnd(link, 0); | 25 r1.setEnd(link, 0); |
26 | 26 |
27 var r2 = document.createRange(); | 27 var r2 = document.createRange(); |
28 r2.setStart(text, 0); | 28 r2.setStart(text, 0); |
29 r2.setEnd(text, 0); | 29 r2.setEnd(text, 0); |
30 | 30 |
31 try { | 31 try { |
32 var compare = r1.compareBoundaryPoints(Range.START_TO_START, r2); | 32 var compare = r1.compareBoundaryPoints(Range.START_TO_START, r2); |
33 log("Error. compareBoundaryPoints should have thrown an exception."); | 33 log("Error. compareBoundaryPoints should have thrown an exception."); |
34 } catch (e) { | 34 } catch (e) { |
35 var expected = "Error: WrongDocumentError: DOM Exception 4"; | 35 var expected = "WrongDocumentError: A Node was used in a different document
than the one that created it (that doesn't support it)."; |
36 if (e != expected) | 36 if (e != expected) |
37 log("Error. Exception thrown should have been: " + expected); | 37 log("Error. Exception thrown should have been: " + expected); |
38 } | 38 } |
39 </script> | 39 </script> |
OLD | NEW |