2d.text-outside-of-the-flat-tree.html (792B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Canvas outside the flat tree</title> 4 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 5 <link rel="author" href="https://mozilla.org" title="Mozilla"> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1792860"> 7 <link rel="match" href="2d.text-outside-of-the-flat-tree-ref.html"> 8 <div id="host"><canvas id="canvas"></canvas></div> 9 <script> 10 let host = document.getElementById("host"); 11 // Leaves the canvas un-slotted. 12 let root = host.attachShadow({ mode: "open"}); 13 let canvas = document.getElementById("canvas"); 14 let ctx = canvas.getContext("2d"); 15 ctx.font = "10px sans-serif"; 16 ctx.fillText('Hello, world', 10, 10); 17 // Slots the content. 18 root.innerHTML = `<slot></slot>`; 19 </script>