revert-in-fallback.html (1423B)
1 <!DOCTYPE html> 2 <title>CSS Custom Properties: Using revert in fallbacks</title> 3 <link rel="help" href="https://drafts.csswg.org/css-variables/#substitute-a-var"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <style> 7 body.revert { 8 --x:FAIL; 9 margin: -1px; 10 display: grid; 11 12 --x: var(--unknown, revert); 13 margin: var(--unknown, revert); 14 display: var(--unknown, revert); 15 } 16 </style> 17 <html> 18 <body> 19 <pre id=out></pre> 20 <script> 21 let body_ua_display = getComputedStyle(document.body).display; 22 let body_ua_margin = getComputedStyle(document.body).margin; 23 document.body.classList.add('revert'); 24 25 test((t) => { 26 assert_equals(getComputedStyle(document.body).getPropertyValue('--x'), ''); 27 }, 'var(--unknown, revert) in custom property'); 28 29 test((t) => { 30 assert_equals(getComputedStyle(document.body).getPropertyValue('margin'), body_ua_margin); 31 }, 'var(--unknown, revert) in shorthand'); 32 33 test((x) => { 34 assert_equals(getComputedStyle(document.body).getPropertyValue('margin-left'), body_ua_margin); 35 }, 'var(--unknown, revert) in shorthand observed via longhand'); 36 37 test((t) => { 38 assert_equals(getComputedStyle(document.body).getPropertyValue('display'), body_ua_display); 39 }, 'var(--unknown, revert) in longhand'); 40 </script> 41 </body> 42 </html>