Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/element/manual/text/canvas.2d.direction.inherit.document.html - WPT Dashboard Interop Dashboard
<!doctype HTML>
<html dir="rtl">
<meta charset="utf-8">
<head>
<title>HTML5 Canvas Test: The direction attribute inherits correctly</title>
<link rel="match" href="canvas.2d.direction-ref.html" />
<link rel="author" href="mailto:schenney@chromium.org"/>
<meta name="assert" content="When the canvas element has no direction attribute, inherit it from the document." />
<script type="text/javascript">
function runTest()
{
var canvas = document.getElementById("canvas1");
var ctx = canvas.getContext("2d");
// The default for direction is inherit, so no need to set any text styles
ctx.font = "25px serif";
ctx.fillText("ABC!", 60, 50);
}
</script>
<style>
canvas {
position: absolute;
top: 8px;
left: 8px;
}
</style>
</head>
<body onload="runTest()">
<canvas id="canvas1" width="300" height="150">
Browser does not support HTML5 Canvas.
</canvas>
</body>
</html>