custom-highlight-painting-003.html (712B)
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-003-ref.html"> 6 <meta name="assert" value="Intersections of overlapping ranges contained in the same Highlight are painted only once"> 7 <style> 8 ::highlight(sample) { background-color: rgba(0, 0, 255, 0.3); } 9 </style> 10 <body>Lorem Ipsum. 11 <script> 12 let textNode = document.body.firstChild; 13 14 let r1 = new Range(); 15 r1.setStart(textNode, 1); 16 r1.setEnd(textNode, 5); 17 18 let r2 = new Range(); 19 r2.setStart(textNode, 3); 20 r2.setEnd(textNode, 7); 21 22 CSS.highlights.set("sample", new Highlight(r1, r2)); 23 </script>