summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/autofocus-input-css-style-change.html
blob: c36848616e2c828bd8dcce54b9ad8429104668b9 (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
<!DOCYTPE html>
<html>
<style>
input { background: red; }
input:focus { background: green; }
</style>
<body>
<p>The following text box should have focus and should be green.</p>
<input type="text" id="test" autofocus onfocus="setTimeout(test, 0)">
<div id="result">FAIL</div>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function test() {
    var target = document.getElementById("test");
    target.offsetTop;
    if (document.defaultView.getComputedStyle(target, null).getPropertyValue('background-color') == "rgb(0, 128, 0)")
        result.innerHTML = "PASS";
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</body>
</html>