Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=402680
5 -->
6 <head>
7 <title>Test for Bug 402680</title>
8 <script>
9 var activeElementIsNull = (document.activeElement == null);
10 </script>
11 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
13 </head>
14 <body>
15 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402680">Mozilla Bug 402680</a>
16 <p id="display"></p>
17 <div id="content">
18 <input type="text">
19 <textarea></textarea>
20 </div>
21 <pre id="test">
22 <script class="testbody" type="text/javascript">
24 /** Test for Bug 402680 **/
26 ok(activeElementIsNull,
27 "Before document has body, active element should be null");
29 function testActiveElement() {
30 ok(document.body == document.activeElement,
31 "After page load body element should be the active element!");
32 var input = document.getElementsByTagName("input")[0];
33 input.focus();
34 ok(document.activeElement == input,
35 "Input element isn't the active element!");
36 var textarea = document.getElementsByTagName("textarea")[0];
37 textarea.focus();
38 ok(document.activeElement == textarea,
39 "Textarea element isn't the active element!");
40 SimpleTest.finish();
41 }
43 SimpleTest.waitForExplicitFinish();
44 addLoadEvent(testActiveElement);
46 </script>
47 </pre>
48 </body>
49 </html>