summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/focus/support/focus-restoration-in-different-site-iframes-inner.html
blob: d0765790177cb75928c253ab1230cade5e07c968 (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
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Inner document</title>
</head>
<body>
<h1>Inner</h1>
<input type="text">
<script>
window.onmessage = function(e) {
    if (e.data == "getlog") {
        parent.postMessage(log, "*");
    }
};

let log = "log:";
let input = document.getElementsByTagName("input")[0];
input.onfocus = function() {
    log += "inputfocus,"
}
input.onblur = function() {
    log += "inputblur,"
}
document.body.onfocus = function() {
    log += "bodyfocus,"
}
document.body.onblur = function() {
    log += "bodyblur,"
}
window.onload = function() {
    log += "willfocusinput,"
    input.focus();
    log += "didfocusinput,"
    parent.postMessage("start", "*");
}
</script>
</body>
</html>