Check for stylesheet presence (font.js)
If doc doesn't have a stylesheet, create one.
This commit is contained in:
parent
4dd79a51c1
commit
de253dcbe3
4
fonts.js
4
fonts.js
@ -1291,6 +1291,10 @@ var Font = (function Font() {
|
||||
window.btoa(data) + ');');
|
||||
var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}';
|
||||
var styleSheet = document.styleSheets[0];
|
||||
if (!styleSheet) {
|
||||
document.documentElement.firstChild.appendChild( document.createElement('style') );
|
||||
styleSheet = document.styleSheets[0];
|
||||
}
|
||||
styleSheet.insertRule(rule, styleSheet.cssRules.length);
|
||||
|
||||
return rule;
|
||||
|
Loading…
Reference in New Issue
Block a user