custom-highlight-painting-invalidation-004.html (933B)
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 after adding a range to it"> 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 let h = new Highlight(); 21 CSS.highlights.set("example-highlight", h); 22 23 // Force frame paint before modifying the Highlight. 24 runAfterLayoutAndPaint(()=>{ 25 h.add(r); 26 document.documentElement.removeAttribute("class"); 27 }); 28 </script> 29 </html>