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
);
15 if (window
.testRunner
)
16 window
.testRunner
.dumpAsText();
18 var selection
= window
.getSelection();
19 var element
= document
.getElementById("test");
21 if (selection
.setBaseAndExtent
)
22 selection
.setBaseAndExtent(element
, 0, element
, 1);
23 else if (selection
.selectAllChildren
)
24 selection
.selectAllChildren(element
);
26 throw("Couldn't set a selection.");
28 if (selection
.toString
) {
29 var string
= selection
.toString();
30 if (string
!= selection
)
31 throw("Implicit toString call did not match explicit call");
32 if (string
!= "hello world")
33 throw("Selection::toString() returned incorrect results.");
36 throw("Selection::toString() not supported");
38 log("Test Failed. Error was: " + e
);
43 <p>This tests Selection::toString(): that it exists, that it returns the same result as the implicit toString call, and that it returns the correct results.
</p>
44 <div id=
"test" style=
"border: 1px solid black;">hello world
</div>
45 <ul id=
"console"></ul>
46 <script>runTest();</script>