gecko-dev/testing/web-platform/tests/fullscreen/api/element-request-fullscreen-...

29 строки
1.1 KiB
HTML

<!DOCTYPE html>
<title>Element#requestFullscreen() followed by moving the element into an iframe</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<div id="log"></div>
<div id="target"></div>
<iframe allowfullscreen></iframe>
<script>
async_test(t => {
const target = document.getElementById("target");
const iframeDoc = document.querySelector("iframe").contentDocument;
iframeDoc.onfullscreenchange = t.unreached_func("fullscreenchange event in iframe");
iframeDoc.onfullscreenerror = t.unreached_func("fullscreenerror event in iframe");
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
document.onfullscreenerror = t.step_func_done(() => {
assert_equals(document.fullscreenElement, null, "outer fullscreen element");
assert_equals(iframeDoc.fullscreenElement, null, "inner fullscreen element");
assert_equals(event.target, document, "event target");
});
trusted_click(t, () => {
target.requestFullscreen();
iframeDoc.body.appendChild(target);
}, document.body);
});
</script>