custom-highlight-painting-iframe-006.html (1421B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <meta charset="UTF-8"> 4 <title>CSS Highlight API Test: </title> 5 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/"> 6 <link rel="match" href="custom-highlight-painting-iframe-006-ref.html"> 7 <meta name="assert" value="Ranges contained in a registered Highlight that are moved to another document different than the owner of the HighlightRegistry where the Highlight has been registered should not be painted anymore."> 8 <script src="resources/run-after-layout-and-paint.js"></script> 9 <style> 10 ::highlight(foo) { 11 color: green; 12 background-color: greenyellow; 13 } 14 </style> 15 <body> 16 <iframe 17 id="iframe" 18 srcdoc=" 19 <style> 20 ::highlight(foo) { 21 color: blue; 22 background-color: cyan; 23 } 24 </style> 25 <span id='span-iframe'>abc</span> 26 " 27 > 28 </iframe> 29 <br> 30 <span id="span-doc">abc</span> 31 <script> 32 let spanDoc = document.querySelector("#span-doc"); 33 let r = new Range(); 34 r.setStart(spanDoc, 0); 35 r.setEnd(spanDoc, 1); 36 37 let h = new Highlight(r); 38 CSS.highlights.set("foo", h); 39 40 let iframe = document.querySelector("#iframe"); 41 iframe.onload = () => { 42 let spanIframe = iframe.contentDocument.querySelector("#span-iframe"); 43 runAfterLayoutAndPaint(()=>{ 44 r.setStart(spanIframe, 0); 45 r.setEnd(spanIframe, 1); 46 document.documentElement.removeAttribute("class"); 47 }); 48 } 49 </script> 50 </html>