Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>drawElementImage should throw if the canvas is nested inside another canvas</title>
<link rel="help" href="https://github.com/WICG/html-in-canvas">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/wait-for-canvas-paint.js"></script>
<canvas id="canvas" layoutsubtree="true" width="100" height="100">
<canvas id="nested_canvas" layoutsubtree="true" width="100" height="100">
<div id="inner_div" style="width: 100px; height: 100px;"></div>
</canvas>
</canvas>
<script>
promise_test(async (t) => {
await waitForCanvasPaint(canvas);
const ctx = nested_canvas.getContext('2d');
assert_throws_dom("NotSupportedError", () => {
ctx.drawElementImage(inner_div, 0, 0, 100, 100);
});
}, "drawElementImage should throw if called on a nested canvas");
</script>