|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=289384 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 289384</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=289384">Mozilla Bug 289384</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" style="display: none"> |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script class="testbody" type="text/javascript"> |
|
19 SimpleTest.waitForExplicitFinish(); |
|
20 |
|
21 addLoadEvent(function() { |
|
22 var win = window.open("data:text/html,<a href=\"data:text/html,<body contenteditable onload='opener.continueTest(window);'>foo bar</body>\">link</a>", "", "test-289384"); |
|
23 win.addEventListener("load", function onLoad() { |
|
24 win.removeEventListener("load", onLoad); |
|
25 win.document.querySelector("a").click(); |
|
26 }, false); |
|
27 }); |
|
28 |
|
29 function continueTest(win) { |
|
30 SimpleTest.waitForFocus(function() { |
|
31 var doc = win.document; |
|
32 var sel = win.getSelection(); |
|
33 doc.body.focus(); |
|
34 sel.collapse(doc.body.firstChild, 3); |
|
35 SimpleTest.executeSoon(function() { |
|
36 synthesizeKey("VK_LEFT", {accelKey: true}, win); |
|
37 ok(sel.isCollapsed, "The selection must be collapsed"); |
|
38 is(sel.anchorNode, doc.body.firstChild, "The anchor node should be the body element's text node"); |
|
39 is(sel.anchorOffset, 0, "The anchor offset should be 0"); |
|
40 win.close(); |
|
41 SimpleTest.finish(); |
|
42 }); |
|
43 }, win); |
|
44 } |
|
45 |
|
46 </script> |
|
47 </pre> |
|
48 </body> |
|
49 </html> |