selection-over-highlight-001.html (823B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Pseudo-Elements Test: selected highlight highlight painting</title> 4 <link rel="author" name="Stephen Chenney" href="mailto:schenney@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-painting"> 6 <meta name="assert" value="Checks that the highlight colors persist when selected."> 7 <link rel="match" href="selection-over-highlight-001-ref.html"> 8 <style> 9 ::selection { 10 background-color: lightblue; 11 } 12 ::highlight(green) { 13 color: green; 14 } 15 </style> 16 <div id="content">When selected, the highlight color should remain.</div> 17 <script> 18 let range = new Range(); 19 range.setStart(content, 0); 20 range.setEnd(content, 1); 21 CSS.highlights.set("green", new Highlight(range)); 22 23 document.execCommand("selectAll"); 24 </script>