1 <p>This tests to see that Range::compareBoundaryPoints throws a WrongDocumentError 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>
7 var console
= document
.getElementById("console");
8 var li
= document
.createElement("li");
9 li
.appendChild(document
.createTextNode(str
));
10 console
.appendChild(li
);
13 if (window
.testRunner
)
14 window
.testRunner
.dumpAsText();
16 var div
= document
.getElementById("div");
17 var text
= div
.firstChild
;
18 var link
= div
.lastChild
;
21 text
.parentNode
.removeChild(text
);
23 var r1
= document
.createRange();
27 var r2
= document
.createRange();
32 var compare
= r1
.compareBoundaryPoints(Range
.START_TO_START
, r2
);
33 log("Error. compareBoundaryPoints should have thrown an exception.");
35 var expected
= "WrongDocumentError: Failed to execute 'compareBoundaryPoints' on 'Range': The source range is in a different document than this range.";
37 log("Error. Exception thrown should have been: " + expected
);