active-selection-016.html (1320B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Pseudo-Elements Test: active selection of partial text and color</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-016-ref.html"> 11 12 13 <link rel="stylesheet" href="support/highlights.css"> 14 <style> 15 div 16 { 17 background-color: white; 18 color: white; 19 font-size: 300%; 20 } 21 22 div::selection 23 { 24 color: green; 25 } 26 </style> 27 28 <script> 29 function startTest() 30 { 31 var targetRange = document.createRange(); 32 /* We first create an empty range */ 33 targetRange.setStart(document.getElementById("test").childNodes[0], 5); 34 /* 35 Then we set the start boundary of the range inside div#test to 36 */ 37 targetRange.setEnd(document.getElementById("test").childNodes[0], 9); 38 /* And we set the end boundary of the range inside div#test right */ 39 window.getSelection().addRange(targetRange); 40 /* Finally, we now select such range of content */ 41 } 42 </script> 43 44 <body onload="startTest();"> 45 46 <div id="test" class="highlight_reftest">FAIL PASS FAIL</div>