Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/element/manual/draw-element-image/nested-div-layoutsubtree-canvas.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>drawElementImage should throw if the canvas is nested inside another canvas</title>
<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">
<div id="nested_div">
<canvas id="nested_canvas" layoutsubtree="true" width="100" height="100">
<div id="inner_div" style="width: 100px; height: 100px;"></div>
</canvas>
</div>
</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 in a div");
</script>