highlight-z-index-002.html (1511B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Pseudo-Elements Test: highlight pseudo-element drawn below positioned element</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-painting"> 9 <link rel="match" href="highlight-z-index-002-ref.html"> 10 11 <meta name="assert" content="This test checks that the ::selection pseudo-element must be drawn below an absolutely positioned element. In this test, such absolutely positioned element is a preceding sibling element."> 12 13 <style> 14 div 15 { 16 font-size: 48px; 17 line-height: 1.25; /* computes to 60px */ 18 } 19 20 div#abs-positioned-sibling 21 { 22 background-color: yellow; 23 color: green; 24 position: absolute; 25 } 26 27 div#test::selection 28 { 29 background-color: red; 30 color: yellow; 31 } 32 </style> 33 34 <script> 35 function startTest() 36 { 37 var targetRange = document.createRange(); 38 /* We first create an empty range */ 39 targetRange.selectNodeContents(document.getElementById("test")); 40 /* Then we set the range boundaries to the children of div#test */ 41 window.getSelection().addRange(targetRange); 42 /* Finally, we now select such range of content */ 43 } 44 </script> 45 46 <body onload="startTest();"> 47 48 <p>Test passes if "Text sample" is green and if its background color is yellow. 49 50 <div id="abs-positioned-sibling">Test sample</div> 51 52 <div id="test">Test sample</div>