canvas.2d.direction.inherit.document.html (1042B)
1 <!doctype HTML> 2 <html dir="rtl"> 3 <meta charset="utf-8"> 4 <title>HTML5 Canvas Test: The direction attribute inherits correctly</title> 5 <link rel="match" href="canvas.2d.direction-ref.html" /> 6 <link rel="author" href="mailto:schenney@chromium.org"/> 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#text-styles"/> 8 <meta name="assert" content="When the canvas element has no direction attribute, inherit it from the document." /> 9 <script type="text/javascript"> 10 function runTest() { 11 var canvas = document.getElementById("canvas1"); 12 var ctx = canvas.getContext("2d"); 13 14 // The default for direction is inherit, so no need to set any text styles, 15 ctx.font = "25px serif"; 16 ctx.fillText("ABC!", 60, 50); 17 } 18 </script> 19 <style> 20 canvas { 21 position: absolute; 22 top: 8px; 23 left: 8px; 24 } 25 </style> 26 <body onload="runTest()"> 27 <canvas id="canvas1" width="300" height="150"> 28 Browser does not support HTML5 Canvas. 29 </canvas> 30 </body> 31 </html>