OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>basic "autofocus" test</title> | 3 <title>basic "autofocus" test</title> |
4 <style> | 4 <style> |
5 input { background:red } | 5 input { background:red } |
6 input:focus { background:lime } | 6 input:focus { background:lime } |
7 </style> | 7 </style> |
8 <script src="../js/resources/js-test-pre.js"></script> | 8 <script src="../../resources/js-test.js"></script> |
9 <script language="JavaScript" type="text/javascript"> | 9 <script language="JavaScript" type="text/javascript"> |
10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
11 | 11 |
12 function elementBlur() { | 12 function elementBlur() { |
13 document.getElementById("input1").type = "password"; | 13 document.getElementById("input1").type = "password"; |
14 } | 14 } |
15 function elementFocus() { | 15 function elementFocus() { |
16 document.getElementById("input1").type = "text"; | 16 document.getElementById("input1").type = "text"; |
17 } | 17 } |
18 | 18 |
19 function test() { | 19 function test() { |
20 document.getElementById("input2").focus(); | 20 document.getElementById("input2").focus(); |
21 shouldBe('document.activeElement', 'document.getElementById("input2")'); | 21 shouldBe('document.activeElement', 'document.getElementById("input2")'); |
22 finishJSTest(); | 22 finishJSTest(); |
23 } | 23 } |
24 </script> | 24 </script> |
25 </head> | 25 </head> |
26 <body onload="test()"> | 26 <body onload="test()"> |
27 <input id="input1" type="text" autofocus onblur="elementBlur()" onfocus="element
Focus()"/> | 27 <input id="input1" type="text" autofocus onblur="elementBlur()" onfocus="element
Focus()"/> |
28 <br/> | 28 <br/> |
29 <p>This form control should have a green background and active state:<input id="
input2"> | 29 <p>This form control should have a green background and active state:<input id="
input2"> |
30 <hr> | 30 <hr> |
31 <pre id="console"> | 31 <pre id="console"> |
32 | 32 |
33 </pre> | 33 </pre> |
34 </body> | 34 </body> |
35 </html> | 35 </html> |
OLD | NEW |