cross-shadow-boundary-6.html (1079B)
1 <!doctype html> 2 <html class="reftest-wait"> 3 <head> 4 <link rel=match href="cross-shadow-boundary-6-ref.html"> 5 </head> 6 <span id="span">Start 7 <div> 8 <template shadowrootmode="open"> 9 <span id="inner1">inner1</p> 10 <span id="inner2">inner2</p> 11 </template> 12 </div> 13 </span> 14 <script> 15 const start = document.getElementById("span").firstChild; 16 const end = document.querySelector('div').shadowRoot.getElementById("inner2"); 17 18 async function waitForRAFs() { 19 return new Promise(resolve => { 20 window.requestAnimationFrame(() => { 21 window.requestAnimationFrame(() => { 22 window.requestAnimationFrame(() => { 23 resolve(); 24 }); 25 }); 26 }); 27 }); 28 } 29 30 async function runTest() { 31 window.getSelection().setBaseAndExtent(start, 3, end.firstChild, 3); 32 await waitForRAFs(); 33 34 window.getSelection().removeAllRanges(); 35 await waitForRAFs(); 36 37 window.getSelection().setBaseAndExtent(start, 3, end.firstChild, 3); 38 await waitForRAFs(); 39 document.documentElement.className = ""; 40 } 41 42 runTest(); 43 </script> 44 </html>