Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / autofocus-opera-005.html
blob6e69499c703e4b7d74ceac938067b5731145bd8f
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <title>testing "autofocus" in XHTML with dynamic changes (part two)</title>
4 <style>
5 input { background:red }
6 input:focus { background:lime }
7 </style>
8 <script language="JavaScript" type="text/javascript">
9 function log(message) {
10 document.getElementById("console").innerHTML += "<li>"+message+"</li>";
13 function test() {
14 var input = document.getElementsByTagName('input')[0];
15 var p = document.getElementsByTagName('p')[0];
16 var input = p.removeChild(input);
17 input.autofocus = true;
18 input.addEventListener('focus', check, false);
19 p.appendChild(input);
21 if (window.testRunner) {
22 testRunner.dumpAsText();
23 testRunner.waitUntilDone();
25 setTimeout(check, 1000);
28 function check() {
29 if (document.activeElement == document.getElementsByTagName("input")[0])
30 log("SUCCESS");
31 else
32 log("FAILURE");
34 if (window.testRunner)
35 testRunner.notifyDone();
37 </script>
38 </head>
39 <body onload="test()">
40 <p>The form control should have a green background: <input/></p>
41 <hr/>
42 <ol id="console"></ol>
43 </body>
44 </html>