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.selectNodeContents() of a text node and a br.
</p>
16 <div id=targetParent
>two
<br>three
</div>
18 <ul id=
"console"></ul>
21 textNode
= targetParent
.firstChild
;
22 range
= document
.createRange();
23 range
.selectNodeContents(textNode
);
24 if (range
.startContainer
!= textNode
)
25 throw("range.startContainer != textNode");
26 if (range
.endContainer
!= textNode
)
27 throw("range.endContainer != textNode");
28 if (range
.startOffset
!= 0)
29 throw("Incorrect startOffset in textNode.");
30 if (range
.endOffset
!= 3)
31 throw("Incorrect endOffset in textNode.");
32 if (range
.toString() != "two")
33 throw("Couldn't get the contents of a text node.");
35 brNode
= textNode
.nextSibling
;
36 range
.selectNodeContents(brNode
);
37 if (range
.startContainer
!= brNode
)
38 throw("range.startContainer != brNode");
39 if (range
.endContainer
!= brNode
)
40 throw("range.endContainer != brNode");
41 if (range
.startOffset
!= 0)
42 throw("Incorrect startOffset in br node.");
43 if (range
.endOffset
!= 0)
44 throw("Incorrect endOffset in br node.");
45 if (range
.toString() != "")
46 throw("Found br node with non-empty content.");
50 log("Test Failed. Error was: " + e
);