summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/the-window-object/focus.window.js
blob: 6ec7feee281e756ae6452e0f9b17d9b93032d010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
async_test(t => {
  const input = document.body.appendChild(document.createElement("input"));
  input.onfocus = t.step_func(() => {
    const frame = document.body.appendChild(document.createElement("iframe")),
          frameW = frame.contentWindow;
    frameW.onfocus = t.unreached_func();
    frame.remove();
    frameW.focus();
    t.step_timeout(() => {
      assert_equals(document.activeElement, input);
      t.done();
    }, 100);
  });
  input.focus();
});