Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / autofocus-focus-only-once.html
blob198909e6f8253c2c96a10d337716c1b8671c9576
1 <html>
2 <head>
3 <title>basic "autofocus" test</title>
4 <style>
5 input { background:red }
6 input:focus { background:lime }
7 </style>
8 <script src="../../resources/js-test.js"></script>
9 <script language="JavaScript" type="text/javascript">
10 window.jsTestIsAsync = true;
12 function elementBlur() {
13 document.getElementById("input1").type = "password";
15 function elementFocus() {
16 document.getElementById("input1").type = "text";
19 function test() {
20 document.getElementById("input2").focus();
21 shouldBe('document.activeElement', 'document.getElementById("input2")');
22 finishJSTest();
24 </script>
25 </head>
26 <body onload="test()">
27 <input id="input1" type="text" autofocus onblur="elementBlur()" onfocus="elementFocus()"/>
28 <br/>
29 <p>This form control should have a green background and active state:<input id="input2">
30 <hr>
31 <pre id="console">
33 </pre>
34 </body>
35 </html>