variable-reference-shorthands-cssom.html (1301B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS variable references - shorthand properties - via CSSOM</title> 5 6 <meta rel="author" title="Kevin Babbitt"> 7 <meta rel="author" title="Greg Whitworth"> 8 <link rel="author" title="Microsoft Corporation" href="http://microsoft.com" /> 9 <link rel="help" href="http://www.w3.org/TR/css-variables-1/#serializing-custom-props"> 10 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 </head> 14 <body> 15 16 <div id="target"></div> 17 18 <script type="text/javascript"> 19 "use strict"; 20 21 function runTest() { 22 var target = document.getElementById("target"); 23 24 target.style.setProperty("margin", "var(--prop)"); 25 assert_equals(target.style.margin, "var(--prop)", "margin property value after calling setProperty"); 26 assert_equals(target.style.getPropertyValue("margin"), "var(--prop)", "getPropertyValue('margin') after calling setProperty"); 27 28 target.style.removeProperty("margin"); 29 assert_equals(target.style.margin, "", "margin property value after calling removeProperty"); 30 assert_equals(target.style.getPropertyValue("margin"), "", "getPropertyValue('margin') after calling removeProperty"); 31 } 32 33 test(runTest); 34 </script> 35 36 </body> 37 </html>