summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fullscreen/model/move-to-inactive-document.html
blob: b9a95f29548934dfcefafc4a121edf29ffd0951a (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
40
<!DOCTYPE html>
<title>Move the fullscreen element to an inactive document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="../trusted-click.js"></script>
<div></div>
<script>
  promise_test(async (t) => {
    t.add_cleanup(() => {
      if (document.fullscreenElement) {
        return document.exitFullscreen();
      }
    });
    const div = document.querySelector("div");

    // Go fullscreen...
    await Promise.all([trusted_request(div), fullScreenChange()]);

    const inactiveDocument = document.implementation.createDocument(null, "");

    div.onfullscreenchange = t.unreached_func(
      "fullscreenchange fired on element"
    );
    inactiveDocument.onfullscreenchange = t.unreached_func(
      "fullscreenchange fired on other document"
    );

    // Transplant element to inactive document...
    inactiveDocument.appendChild(div);

    // Fullscreen exits...
    await fullScreenChange();
    // Make sure no other events fire...
    await new Promise((resolve) => {
      requestAnimationFrame(resolve);
    });
  });
</script>