outline-width-computed.html (1660B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS UI Level 3: getComputedStyle().outlineWidth</title> 6 <link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline-width"> 7 <meta name="assert" content="outline-width computed value is absolute length, 0 if the outline style is none."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/computed-testcommon.js"></script> 11 </head> 12 <body> 13 <style> 14 #target { 15 font-size: 40px; 16 17 border-style: dotted; /* Avoid border-*-width computed style 0 */ 18 border-top-width: thin; 19 border-right-width: medium; 20 border-bottom-width: thick; 21 22 outline-style: dotted; /* Avoid outline-width computed style 0 */ 23 } 24 </style> 25 <div id="target"></div> 26 <script> 27 test_computed_value("outline-width", "2.5px", "2px"); 28 test_computed_value("outline-width", "10px"); 29 test_computed_value("outline-width", "0.5em", "20px"); 30 test_computed_value("outline-width", "calc(10px + 0.5em)", "30px"); 31 test_computed_value("outline-width", "calc(10px - 0.5em)", "0px"); 32 33 test_computed_value("outline-width", "thin", getComputedStyle(target).borderTopWidth); 34 test_computed_value("outline-width", "medium", getComputedStyle(target).borderRightWidth); 35 test_computed_value("outline-width", "thick", getComputedStyle(target).borderBottomWidth); 36 37 test(() => { 38 target.style['outline-width'] = '10px'; 39 target.style['outline-style'] = 'none'; 40 assert_equals(getComputedStyle(target)['outline-width'], '10px'); 41 target.style['outline-style'] = ''; 42 }, 'outline-width is independent of the value of outline-style'); 43 </script> 44 </body> 45 </html>