custom-highlight-painting-below-selection-transparency.html (904B)
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-selection-transparency-ref.html"> 6 <meta name="assert" 7 value="Highlight overlay is painted below selection overlay. If selection uses transparency, colors are combined."> 8 <style> 9 ::highlight(foo) { 10 background: yellow; 11 } 12 </style> 13 14 <body><span id="highlighted">This should be yellow, <span id="selected">this should mix with the 15 selection,</span></span> this should have no background. 16 <script> 17 let highlightRange = new Range(); 18 highlightRange.setStart(document.body.firstChild, 0); 19 highlightRange.setEnd(document.body.firstChild, 2); 20 CSS.highlights.set("foo", new Highlight(highlightRange)); 21 getSelection().setBaseAndExtent(selected, 0, selected, 1); 22 </script>