declarative-child-frame.html (549B)
1 <div id=iframe> 2 <div id=wrapper> 3 <div id=host> 4 <template shadowrootmode=open> 5 <span id=content>Content</span> 6 </template> 7 </div> 8 </div> 9 </div> 10 11 <script> 12 function sendStatus(error, hasShadow, msg) { 13 const name = window.name; 14 parent.postMessage({ name, error, hasShadow, msg }, '*'); 15 } 16 17 window.addEventListener('load', () => { 18 const host = document.querySelector('#host'); 19 if (!host) 20 return sendStatus(true, false, 'Unable to find host element'); 21 return sendStatus(false, !!host.shadowRoot); 22 }); 23 </script>