custom-highlight-painting-invalidation-001.html (884B)
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-001-ref.html"> 7 <meta name="assert" value="::highlight overlay is correctly invalidated and repainted"> 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 21 // Force frame paint before registering the Highlight. 22 runAfterLayoutAndPaint(()=>{ 23 CSS.highlights.set("example-highlight", new Highlight(r)); 24 document.documentElement.removeAttribute("class"); 25 }); 26 </script> 27 </html>