Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/offscreen/OffscreenCanvas-ctx-font-sibling-index-invalid.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>OffscreenCanvas ctx.font should ignore element-dependent calc and preserve previous value</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-font">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/10982">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
var offscreen = new OffscreenCanvas(64, 64);
var ctx = offscreen.getContext('2d');
ctx.font = "17px Arial";
var before = ctx.font;
ctx.font = "calc(10px * sibling-index()) serif";
assert_equals(ctx.font, before);
}, 'OffscreenCanvas ctx.font should ignore element-dependent calc and preserve previous value');
</script>