Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / toString.html
blobe176d1cd4fd81d71a02709e9d7e3c2e51bcd1af3
1 <script>
2 if (window.testRunner)
3 testRunner.dumpEditingCallbacks();
4 </script>
5 <script>
6 function log(str) {
7 var li = document.createElement("li");
8 li.appendChild(document.createTextNode(str));
9 var console = document.getElementById("console");
10 console.appendChild(li);
13 function runTest() {
14 try {
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);
25 else
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.");
34 log("Success");
35 } else
36 throw("Selection::toString() not supported");
37 } catch(e) {
38 log("Test Failed. Error was: " + e);
41 </script>
42 <body>
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>
47 </body>