cssom-fontfacerule-constructors.html (2104B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSSOM Parsing Test: @font-face rules toString() as valid interfaces</title> 5 <link rel="author" title="Paul Irish" href="mailto:paul.irish@gmail.com"> 6 <link rel="reviewer" title="Ms2ger" href="mailto:ms2ger@gmail.com"> <!-- 2012-06-17 --> 7 <link rel="help" href="https://drafts.csswg.org/css-fonts-4/#om-fontface"> 8 9 <meta name="flags" content="dom"> 10 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 </head> 14 15 <body> 16 <div id="log"></div> 17 18 19 <style id="teststyles"> 20 @font-face { 21 src: url(http://foo/bar/font.ttf); 22 } 23 @font-face { 24 font-family: STIXGeneral; 25 src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf); 26 unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF; 27 } 28 @font-face { 29 font-family: MainText; 30 src: url(http://example.com/font.ttf); 31 font-variant: oldstyle-nums proportional-nums styleset(1,3); 32 } 33 34 @font-face { 35 font-family: BodyText; 36 src: local("HiraMaruPro-W4"); 37 font-variant: proportional-width; 38 font-feature-settings: "ital"; /* Latin italics within CJK text feature */ 39 } 40 </style> 41 42 43 <script> 44 var validRules = document.getElementById('teststyles').sheet.cssRules; 45 46 test(function(){ 47 for (var i = 0; i < validRules.length; ++i) { 48 assert_equals(validRules.item(i).toString(), '[object CSSFontFaceRule]'); 49 } 50 }, '@font-face declarations are instances of CSSFontFaceRule') 51 52 53 test(function(){ 54 for (var i = 0; i < validRules.length; ++i) { 55 assert_equals(validRules.item(i).style.toString(), '[object CSSFontFaceDescriptors]'); 56 } 57 }, 'The style attribute must return a CSSFontFaceDescriptors block') 58 59 </script> 60 61 62 </body> 63 </html>