Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>Element#requestFullscreen() on SVG text element is denied</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 id="log"></div>
<script>
promise_test(async (t) => {
t.add_cleanup(() => {
if (document.fullscreenElement) return document.exitFullscreen();
});
const a = document.body;
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
svg.appendChild(text);
document.documentElement.appendChild(svg);
await Promise.all([
fullScreenChange(),
test_driver.bless("first fullscreen", () => a.requestFullscreen()),
]);
assert_equals(
document.fullscreenElement,
a,
"fullscreen element after first request"
);
// An SVG <text> element is neither an HTML element, an SVG svg element,
// nor a MathML math element, so a fullscreen request on it must be
// denied even when the document is already fullscreen.
await test_driver.bless("second fullscreen", () => {
return promise_rejects_js(t, TypeError, text.requestFullscreen());
});
assert_equals(
document.fullscreenElement,
a,
"fullscreen element is unchanged after denied request"
);
// The denied request must not have set the SVG <text> as the fullscreen
// element synchronously, so this must not crash.
text.getBoundingClientRect();
});
</script>