highlight-cascade-003.html (885B)
1 <!DOCTYPE html> 2 <title>Initial custom property values in :root::selection rule</title> 3 <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-cascade"> 4 <link rel="match" href="highlight-cascade-003-ref.html"> 5 <meta name="assert" value="This test verifies that the initial value given in a custom property registration is respected, when the property is referenced in ::selection styles but no value is defined. The initial value is not the guaranteed-invalid value, so the fallback value in var() is not used."> 6 <script src="../support/selections.js"></script> 7 <style> 8 @property --bg { 9 syntax: "<color>"; 10 inherits: false; 11 initial-value: green; 12 } 13 :root::selection { 14 background-color: var(--bg, red); 15 } 16 </style> 17 <main>PASS if background-color is green when selected</main> 18 <script> 19 selectNodeContents(document.querySelector("main")); 20 </script>