active-selection-014.html (2163B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Pseudo-Elements Test: active selection and text-decoration</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-selectors"> 9 <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-styling"> 10 <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-painting"> 11 <link rel="match" href="reference/active-selection-014-ref.html"> 12 13 <meta content="should" name="flags"> 14 <meta name="assert" content="This test checks that 'text-decoration' applies to highlight pseudo-element. Since neither 'color' nor 'background-color' has been specified by the pseudo-element selector in this test, then OS-default highlight colors should be used. The consequence of this is that the highlight color determines also the color of the underline."> 15 16 <link rel="stylesheet" href="support/highlights.css"> 17 <style> 18 div 19 { 20 font-size: 300%; 21 } 22 23 div::selection 24 { 25 text-decoration: underline; 26 } 27 </style> 28 29 <!-- 30 " 31 The element's own text decorations (both line decorations 32 and emphasis marks) are thus drawn in the pseudo-element's 33 own color when that is not currentColor, regardless of 34 their original color or fill specifications. 35 " 36 coming from 37 https://www.w3.org/TR/css-pseudo-4/#highlight-painting 38 --> 39 40 <script> 41 function startTest() 42 { 43 var targetRange = document.createRange(); 44 /* We first create an empty range */ 45 targetRange.selectNodeContents(document.getElementById("test")); 46 /* Then we set the range boundaries to the children of div#test */ 47 window.getSelection().addRange(targetRange); 48 /* Finally, we now select such range of content */ 49 } 50 </script> 51 52 <body onload="startTest();"> 53 54 <p>Test passes if each glyph of "Selected Text" is underlined and if color and background color of "Selected Text" are the OS-default highlight colors. The underline color must also be the same as the highlight color of "Selected Text". 55 56 <div id="test" class="highlight_reftest">Selected Text</div>