1description("Test to make sure that getRangeAt does not modify the range when returning it.")
2
3var div = document.createElement('div');
4document.body.appendChild(div);
5var textNode = document.createTextNode("asd");
6div.appendChild(textNode);
7
8var sel = window.getSelection();
9sel.collapse(textNode, 0);
10var range = sel.getRangeAt(0);
11
12var result = range.comparePoint(textNode, 0);
13if (result == 0) {
14    testPassed("range is correctly (text, 0)");
15} else {
16    testFailed("range did not match (text, 0)");
17    debug("window.getSelection():");
18    debug("anchorNode: " + sel.anchorNode);
19    debug("anchorOffset: " + sel.anchorOffset);
20    debug("focusNode: " + sel.focusNode);
21    debug("focusOffset: " + sel.focusOffset);
22
23    debug("window.getSelection().getRangeAt(0):");
24    debug("startContainer: " + range.startContainer);
25    debug("startOffset: " + range.startOffset);
26    debug("endContainer: " + range.endContainer);
27    debug("endOffset: " + range.endOffset);
28}
29
30// Clean up after ourselves
31document.body.removeChild(div);
32
33var successfullyParsed = true;
34