active-selection-011.html (1277B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Pseudo-Elements Test: active selection and color (basic)</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="match" href="reference/active-selection-011-ref.html"> 11 12 13 <link rel="stylesheet" href="support/highlights.css"> 14 <style> 15 div 16 { 17 color: red; 18 font-size: 300%; 19 } 20 21 div::selection 22 { 23 color: green; 24 } 25 </style> 26 27 <script> 28 function startTest() 29 { 30 var targetRange = document.createRange(); 31 /* We first create an empty range */ 32 targetRange.selectNodeContents(document.getElementById("test")); 33 /* Then we set the range boundaries to the children of div#test */ 34 window.getSelection().addRange(targetRange); 35 /* Finally, we now select such range of content */ 36 } 37 </script> 38 39 <body onload="startTest();"> 40 41 <p>Test passes if each glyph of "Selected Text" is green and <strong>not red</strong> while background color of each glyph of "Selected Text" is white. 42 43 <div id="test" class="highlight_reftest">Selected Text</div>