attr-length-specified.html (908B)
1 <!DOCTYPE html> 2 <title>CSS Values and Units Test: attr() specified length</title> 3 <meta name="assert" content="Test attr() specified length"> 4 <link rel="help" href="https://drafts.csswg.org/css-values/#attr-notation"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 div { 9 --foo: attr(data-foo type(<length>)); 10 --bar: attr(data-bar type(<length>)); 11 --baz: attr(data-baz em); 12 } 13 </style> 14 15 <div 16 data-foo="3em" 17 data-bar="3EM" 18 data-baz="3" 19 / > 20 21 <script> 22 var elem = getComputedStyle(document.querySelector("div")); 23 test(() => { 24 assert_equals(elem.getPropertyValue("--foo"), "3em"); 25 }, "type(<length>) lowercase") 26 test(() => { 27 assert_equals(elem.getPropertyValue("--bar"), "3em"); 28 }, "type(<length>) uppercase") 29 test(() => { 30 assert_equals(elem.getPropertyValue("--baz"), "3em"); 31 }, "Unit (em) number") 32 </script>