revert-val-003.html (1123B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Cascade: 'revert' keyword in transition</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-cascade/#default"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <style> 10 html, body { margin: 0 } 11 h1 { 12 margin: 0; 13 transition: margin 10s; 14 transition-delay: -5s; /* So we can expect it to be half-way the transition when toggling the property */ 15 } 16 </style> 17 <h1>This is a header that should get some margin</h1> 18 <script> 19 test(function() { 20 const el = document.querySelector("h1"); 21 const cs = getComputedStyle(el); 22 assert_equals(cs.marginTop, "0px", "Margin before transition"); 23 el.style.margin = "revert"; 24 const midTransition = cs.marginTop; 25 assert_not_equals(midTransition, "0px", "Margin mid transition"); 26 el.style.transition = "none"; 27 assert_not_equals(cs.marginTop, midTransition, "Default margin"); 28 }, "revert works with transitions"); 29 </script>