/*! { "name": "@font-face", "property": "fontface", "authors": ["Diego Perini", "Mat Marquis"], "tags": ["css"], "knownBugs": [ "False Positive: WebOS https://github.com/Modernizr/Modernizr/issues/342", "False Positive: WP7 https://github.com/Modernizr/Modernizr/issues/538" ], "notes": [{ "name": "@font-face detection routine by Diego Perini", "href": "http://javascript.nwbox.com/CSSSupport/" }, { "name": "Filament Group @font-face compatibility research", "href": "https://docs.google.com/presentation/d/1n4NyG4uPRjAA8zn_pSQ_Ket0RhcWC6QlZ6LMjKeECo0/edit#slide=id.p" }, { "name": "Filament Grunticon/@font-face device testing results", "href": "https://docs.google.com/spreadsheet/ccc?key=0Ag5_yGvxpINRdHFYeUJPNnZMWUZKR2ItMEpRTXZPdUE#gid=0" }, { "name": "CSS fonts on Android", "href": "https://stackoverflow.com/questions/3200069/css-fonts-on-android" }, { "name": "@font-face and Android", "href": "http://archivist.incutio.com/viewlist/css-discuss/115960" }] } !*/ define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) { var unsupportedUserAgent = (function() { var ua = navigator.userAgent; var webos = ua.match(/w(eb)?osbrowser/gi); var wppre8 = ua.match(/windows phone/gi) && ua.match(/iemobile\/([0-9])+/gi) && parseFloat(RegExp.$1) >= 9; return webos || wppre8; }()); if (unsupportedUserAgent) { Modernizr.addTest('fontface', false); } else { testStyles('@font-face {font-family:"font";src:url("https://")}', function(node, rule) { var style = document.getElementById('smodernizr'); var sheet = style.sheet || style.styleSheet; var cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; var bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; Modernizr.addTest('fontface', bool); }); } });