active-selection-021.html (1699B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Pseudo-Elements Test: active selection, color and 'text-decoration: underline overline line-through'</title> 6 7 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> 8 <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-styling"> 9 <link rel="match" href="reference/active-selection-021-ref.html"> 10 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 11 12 13 <link rel="stylesheet" href="support/highlights.css"> 14 <style> 15 div 16 { 17 color: red; 18 font: 25px/1 Ahem; 19 text-decoration: underline overline line-through; 20 } 21 22 div::selection 23 { 24 color: green; 25 } 26 </style> 27 28 <!-- 29 " 30 The element's own text decorations (both line decorations 31 and emphasis marks) are thus drawn in the pseudo-element's 32 own color when that is not currentColor, regardless of 33 their original color or fill specifications. 34 " 35 coming from 36 https://www.w3.org/TR/css-pseudo-4/#highlight-painting 37 --> 38 39 <script> 40 function startTest() 41 { 42 var targetRange = document.createRange(); 43 /* We first create an empty range */ 44 targetRange.selectNodeContents(document.getElementById("test")); 45 /* Then we set the range boundaries to the children of div#test */ 46 window.getSelection().addRange(targetRange); 47 /* Finally, we now select such range of content */ 48 } 49 </script> 50 51 <body onload="startTest();"> 52 53 <p>Test passes if each glyph of "Selected Text" is green and <strong>not red</strong> and if the underline, the overline and the line-through are also green and not red. 54 55 <div id="test" class="highlight_reftest">Selected Text</div>