summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/interaction/focus/the-autofocus-attribute/resources/child-iframe.html
blob: f60acfc8710192f72813738f0f67e4f512f8163e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<script src="/common/get-host-info.sub.js"></script>
<iframe id="iframe" width="200" height="100"></iframe>

<script>
  iframe.src =
    get_host_info().ORIGIN + "/html/interaction/focus/the-autofocus-attribute/resources/grand-child-autofocus.html";
  window.addEventListener("message", event => {
    if (event.data == "grand_child_loaded") {
      parent.postMessage("ready", "*");
    } else if (event.data == "report_focus_state") {
      frames[0].postMessage("report_focus_state", "*");
    } else if (event.data == "grand_child_is_focused" ||
               event.data == "grand_child_is_not_focused") {
      parent.postMessage(event.data, "*");
    }
  });
</script>