font-shorthand-variant.html (1158B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Fonts Module Level 4: font-variant vs font shorthand</title> 6 <link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop"> 7 <meta name="assert" content="Only the CSS2 font-variant values (normal | small-caps) are supported by the font shorthand."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 </head> 11 <body> 12 <div id="container"> 13 <div id="target"></div> 14 </div> 15 <script> 16 test(() => { 17 const target = document.getElementById('target'); 18 target.style.font = "medium serif"; 19 target.style.fontVariant = "small-caps"; 20 assert_equals(target.style.font, "small-caps medium serif", "font should be updated"); 21 target.style.fontVariant = "titling-caps"; 22 assert_equals(target.style.font, "", "font should be empty"); 23 target.style.fontVariant = "normal"; 24 assert_equals(target.style.font, "medium serif", "font should be reset"); 25 target.style.fontVariant = "full-width"; 26 assert_equals(target.style.font, "", "font should be empty"); 27 }, "font shorthand returns only CSS2 font-variant values"); 28 </script> 29 </body> 30 </html>