Bug 1934520 - [devtools] Avoid errors in document-events webconsole listeners for...
[gecko.git] / layout / reftests / printing / test-print-selection-shadow-dom.html
blobc2681319947025d60f7b929f47338a7a75260178
1 <!DOCTYPE html>
2 <html reftest-print-range="selection">
3 <head>
4 <meta charset="utf-8">
5 <link href="print.css" rel="stylesheet">
6 <script>
7 function selectNodesInShadowTree() {
8 let host = document.getElementById("host");
9 host.attachShadow({ mode: "open" }).innerHTML = `
10 <p>This text should not be there</p>
11 <p id="selection">This text should appear on page 1</p>
12 <p>This text should not be there</p>
14 let rng = document.createRange();
15 rng.selectNode(host.shadowRoot.getElementById("selection"));
16 window.getSelection().addRange(rng);
18 </script>
19 </head>
20 <body onload="selectNodesInShadowTree()">
21 <p>This text should not be there</p>
22 <div id="host">Shouldn't show up (in the shadows)</div>
23 <p>This text should not be there</p>
24 </body>
25 </html>