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.dynamic.canvas.html - WPT Dashboard Interop Dashboard
<!doctype HTML>
<html dir="ltr">
<meta charset="utf-8">
<head>
<title>HTML5 Canvas Test: The direction attribute dynamiclaly updates</title>
<link rel="match" href="canvas.2d.direction.dynamic-ref.html"/>
<link rel="author" href="mailto:schenney@chromium.org"/>
<link rel="help"
<meta name="assert" content="Verify that a text direction change is applied."/>
<script type="text/javascript">
function runTest()
{
var canvas = document.getElementById("canvas1");
var ctx = canvas.getContext("2d");
ctx.font = "25px serif";
ctx.fillText("ABC!", 60, 50);
canvas.setAttribute("dir", "ltr");
ctx.fillText("ABC!", 60, 100);
}
</script>
</head>
<body onload="runTest()">
<canvas dir="rtl" id="canvas1" width="300" height="150">
Browser does not support HTML5 Canvas.
</canvas>
</body>
</html>