custom-highlight-painting-below-selection.html (826B)
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-ref.html"> 6 <meta name="assert" value="Highlight overlay is painted below selection overlay"> 7 <style> 8 ::highlight(foo) { 9 background: cyan; 10 color: blue; 11 } 12 ::selection { 13 background: blue; 14 color: cyan; 15 } 16 </style> 17 <body>Text should be blue over cyan here and <span id="selected">cyan over blue here</span>. 18 <script> 19 let highlightRange = new Range(); 20 highlightRange.setStart(document.body.firstChild, 0); 21 highlightRange.setEnd(document.body.lastChild, 0); 22 CSS.highlights.set("foo", new Highlight(highlightRange)); 23 getSelection().setBaseAndExtent(selected, 0, selected, 1); 24 </script>