Editing tests should use testRunner instead of layoutTestController
[WebKit-https.git] / LayoutTests / editing / selection / getRangeAt.html
1 <html>
2 <head>
3 <script>
4 if (window.testRunner)
5      testRunner.dumpEditingCallbacks();
6 </script>
7 <script>
8 function log(str) {
9     if (str == null)
10         str = "null"
11     var li = document.createElement("li");
12     var pre = document.createElement("pre");
13     pre.appendChild(document.createTextNode(str));
14     li.appendChild(pre);
15     var console = document.getElementById("console");
16     console.appendChild(li);
17 }
18
19 function runTest() {
20     var elem = document.getElementById("test");
21     var sel = window.getSelection();
22     
23     if (window.testRunner)
24         window.testRunner.dumpAsText();
25
26     try {
27         sel.setBaseAndExtent(elem, 0, elem, 1);
28         var range = sel.getRangeAt(0);
29         log(range);
30         log(range.startContainer);
31         log(range.endContainer);
32         
33     } catch(e) {
34         log("Error: " + e);
35     }
36 }
37 </script></head>
38 <body onload="runTest();">
39 <p>This tests that Selection::getRangeAt(int) returns a valid Range object.</p>
40 <div id="test" style="border:1px solid black; padding:1em;">hello</div>
41 <ul id="console"></ul>
42 </body>
43 </html>