custom-highlight-painting-invalidation-006.html (1057B)
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 inserting a new node inside one of its ranges"> 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>two </span><span>three…</span> 16 <script> 17 let r = new Range(); 18 r.setStart(document.body, 0); 19 r.setEnd(document.body, 1); 20 CSS.highlights.set("example-highlight", new Highlight(r)); 21 let newNode = document.createElement("span"); 22 newNode.innerText = "One "; 23 24 // Force frame paint before inserting a new node. 25 runAfterLayoutAndPaint(()=>{ 26 document.body.insertBefore(newNode, document.body.firstChild); 27 document.documentElement.removeAttribute("class"); 28 }); 29 </script> 30 </html>