cssstyledeclaration-custom-properties.html (1105B)
1 <!doctype html> 2 <title>CSS Test: computed style declaration includes custom properties.</title> 3 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 4 <link rel="author" href="https://mozilla.org" title="Mozilla"> 5 <link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle"> 6 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/1316"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <div style="--foo:bar"></div> 10 <div></div> 11 <script> 12 test(function() { 13 let withCustom = getComputedStyle(document.querySelector("div")); 14 let withoutCustom = getComputedStyle(document.querySelector("div + div")); 15 assert_equals(withCustom.getPropertyValue("--foo"), "bar", "Should be returned from getPropertyValue"); 16 assert_equals(withCustom.length, withoutCustom.length + 1, "Should show up in .length"); 17 assert_equals(withCustom[withCustom.length - 1], "--foo", "Should be after all the non-custom properties"); 18 }, "Custom properties are included in computed style"); 19 </script>