|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=656283 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 656283</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 </head> |
|
11 <body onload="test()"> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=656283">Mozilla Bug 656283</a> |
|
13 <p id="display"></p> |
|
14 <div id="content" style="display: none"> |
|
15 |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script type="application/javascript"> |
|
19 |
|
20 /** Test for Bug 656283 **/ |
|
21 |
|
22 SimpleTest.waitForExplicitFinish(); |
|
23 |
|
24 var ifr; |
|
25 function test() { |
|
26 // First a test with data documents. |
|
27 var d = document.implementation.createHTMLDocument(""); |
|
28 is(d.activeElement, d.body, "Active element should be body by default! (1)"); |
|
29 |
|
30 |
|
31 ifr = document.getElementById("ifr"); |
|
32 ifr.onload = test2; |
|
33 ifr.src = "data:text/html,1"; |
|
34 } |
|
35 |
|
36 var firstDoc; |
|
37 function test2() { |
|
38 firstDoc = ifr.contentDocument; |
|
39 is(firstDoc.activeElement, firstDoc.body, |
|
40 "Active element should be body by default! (2)"); |
|
41 ifr.onload = test3; |
|
42 ifr.src = "data:text/html,<input>"; |
|
43 } |
|
44 |
|
45 function test3() { |
|
46 ifr.contentDocument.getElementsByTagName("input")[0].focus(); |
|
47 is(firstDoc.activeElement, firstDoc.body, |
|
48 "Active element should be body by default! (3)"); |
|
49 ifr.parentNode.removeChild(ifr); |
|
50 is(firstDoc.activeElement, firstDoc.body, |
|
51 "Active element should be body by default! (4)"); |
|
52 SimpleTest.finish(); |
|
53 } |
|
54 |
|
55 </script> |
|
56 </pre> |
|
57 <iframe id="ifr"></irame> |
|
58 </body> |
|
59 </html> |