custom-highlight-painting-invalidation-002.html (954B)
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-staticrange-001-ref.html"> 7 <meta name="assert" value="::highlight overlay is correctly invalidated and repainted after deletion"> 8 <script src="resources/run-after-layout-and-paint.js"></script> 9 <style> 10 ::highlight(example-highlight) { 11 background-color: yellow; 12 color: blue; 13 } 14 </style> 15 <body><span>One </span><span>two </span><span>three…</span> 16 <script> 17 let r = new Range(); 18 r.setStart(document.body, 0); 19 r.setEnd(document.body, 2); 20 CSS.highlights.set("example-highlight", new Highlight(r)); 21 22 // Force frame paint before deleting the Highlight. 23 runAfterLayoutAndPaint(()=>{ 24 CSS.highlights.delete("example-highlight"); 25 document.documentElement.removeAttribute("class"); 26 }); 27 </script> 28 </html>