3 testRunner
.dumpEditingCallbacks();
7 var li
= document
.createElement("li");
8 li
.appendChild(document
.createTextNode(str
));
9 var console
= document
.getElementById("console");
10 console
.appendChild(li
);
14 <p>This tests Range.selectNode() of a text node and a br.
</p>
16 <div id=targetParent
>two
<br>three
</div>
18 <ul id=
"console"></ul>
21 // selectNode of a text node
22 textNode
= targetParent
.firstChild
;
23 range
= document
.createRange();
24 range
.selectNode(textNode
);
25 if (range
.startContainer
!= textNode
.parentNode
)
26 throw("range.startContainer != textNode.parentNode");
27 if (range
.endContainer
!= textNode
.parentNode
)
28 throw("range.endContainer != textNode.parentNode");
29 if (range
.startOffset
!= 0)
30 throw("Incorrect startOffset in div.");
31 if (range
.endOffset
!= 1)
32 throw("Incorrect endOffset in div.");
33 if (range
.toString() != "two")
34 throw("Couldn't get the contents of a text node.");
36 brNode
= textNode
.nextSibling
;
37 range
.selectNode(brNode
);
38 if (range
.startContainer
!= brNode
.parentNode
)
39 throw("range.startContainer != brNode.parentNode");
40 if (range
.endContainer
!= brNode
.parentNode
)
41 throw("range.endContainer != brNode.parentNode");
42 if (range
.startOffset
!= 1)
43 throw("Incorrect startOffset in br node.");
44 if (range
.endOffset
!= 2)
45 throw("Incorrect endOffset in br node.");
46 if (range
.toString() != "")
47 throw("Found br node with non-empty content.");
51 log("Test Failed. Error was: " + e
);