Source code
Revision control
Copy as Markdown
Other Tools
<!doctype HTML>
<html dir="rtl">
<meta charset="utf-8">
<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>
<body onload="runTest()">
<canvas id="canvas1" width="300" height="150">
Browser does not support HTML5 Canvas.
</canvas>
</body>
</html>