custom-highlight-painting-below-target-text.html (915B)
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-below-target-text-ref.html"> 6 <meta name="assert" value="Style properties defined in a ::highlight shouldn't be overriden by default values if there's another pseudo overlay painted on top of it (::target-text in this case) which doesn't specify a value for that property (color in this case)"> 7 <style> 8 ::highlight(foo) { 9 color:limegreen; 10 background-color:yellow; 11 } 12 ::target-text { 13 background-color:orange; 14 } 15 </style> 16 <body>Some text 17 <script> 18 let r = new Range(); 19 r.setStart(document.body.firstChild, 0); 20 r.setEnd(document.body.firstChild, 7); 21 CSS.highlights.set("foo", new Highlight(r)); 22 window.location.href = `custom-highlight-painting-below-target-text.html#:~:text=text`; 23 </script>