custom-highlight-painting-staticrange-004.html (1067B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Highlight API Test: </title> 4 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/"> 5 <link rel="match" href="custom-highlight-painting-staticrange-004-ref.html"> 6 <meta name="assert" value="Highlight is repainted correctly after re-arranging nodes in StaticRange such that highlights go from overlapping to not"> 7 <style> 8 ::highlight(example-highlight) { 9 background-color: rgba(0, 128, 0, 0.5); 10 color: blue; 11 } 12 </style> 13 <body><span>One </span><span>one-point-five </span><span>two </span><span>three…</span> 14 <script> 15 let r1 = new StaticRange({startContainer: document.body.children[0], startOffset: 0, endContainer: document.body.children[2], endOffset: 1}); 16 let r2 = new StaticRange({startContainer: document.body.children[1], startOffset: 0, endContainer: document.body.children[3], endOffset: 1}); 17 CSS.highlights.set("example-highlight", new Highlight(r1,r2)); 18 document.body.appendChild(document.body.children[1]); 19 document.body.appendChild(document.body.children[2]); 20 </script>