fontfaceset-has.html (1194B)
1 <!DOCTYPE html> 2 <html> 3 <head id="head"> 4 <meta charset="utf-8"> 5 <link rel="author" title="Myles C. Maxfield" href="mmaxfield@apple.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-font-loading-3/#dom-fontfaceset-has"> 7 <meta name="assert" content="Ensure that calling FontFaceSet.has() works properly." /> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style id="style"> 11 @font-face { 12 font-family: "WebFont"; 13 src: url("resources/Rochester.otf") format("opentype"); 14 } 15 </style> 16 </head> 17 <body> 18 <script> 19 test(function(t) { 20 let fonts = document.fonts; 21 let font = [...fonts.keys()][0]; 22 let font2 = new FontFace("WebFont2", "url('resources/GenR102.woff2') format('woff2')"); 23 assert_true(fonts.has(font)); 24 assert_false(fonts.has(font2)); 25 fonts.add(font2); 26 assert_true(fonts.has(font)); 27 assert_true(fonts.has(font2)); 28 document.getElementById("head").removeChild(document.getElementById("style")); 29 assert_false(fonts.has(font)); 30 assert_true(fonts.has(font2)); 31 fonts.delete(font2); 32 assert_false(fonts.has(font)); 33 assert_false(fonts.has(font2)); 34 }); 35 </script> 36 </body> 37 </html>