summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/autofocus-opera-008.html
blob: 2afe603542d3498be025278df391284b5f547906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>"autofocus" in XHTML and the focus() method</title>
<style>
 input, input#test:focus { background:lime }
 input#test, input:focus { background:red }
</style>
<script language="JavaScript" type="text/javascript">
    function log(message) {
        document.getElementById("console").innerHTML += "<li>"+message+"</li>";
    }

    function test() {
        document.getElementsByTagName('input')[0].focus();
        
        if (window.testRunner)
            testRunner.dumpAsText();

        if (document.activeElement == document.getElementsByTagName('input')[0])
            log("SUCCESS");
        else
            log("FAILURE");
    }
</script>
</head>
<body onload="test()">
<p>The form controls below should have a green background:</p>
<p><input id="test"/></p>
<p><input autofocus="autofocus"/></p>
<p><input autofocus="autofocus"/></p>
<hr/>
<ol id="console"></ol>
</body>
</html>