highlight-styling-001.html (998B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Pseudo-Elements Test: highlight styling: custom properties are applicable properties in highlight pseudos</title> 4 <link rel="author" title="Delan Azabani" href="mailto:dazabani@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-styling"> 6 <link rel="match" href="highlight-styling-001-ref.html"> 7 <meta name="assert" value="This test verifies that ::selection styles can set custom properties and they over-ride the originating element."> 8 <script src="support/selections.js"></script> 9 <link rel="stylesheet" href="support/highlights.css"> 10 <style> 11 main { 12 --x: red; 13 font-size: 7em; 14 margin: 0.5em; 15 } 16 main::selection { 17 --x: green; 18 color: white; 19 background-color: var(--x, blue); 20 } 21 </style> 22 <p>Test passes if the text below is white on green. 23 <main class="highlight_reftest">quick</main> 24 <script>selectNodeContents(document.querySelector("main"));</script>