From: Christian Legnitto Date: Tue, 3 Jan 2012 05:40:43 +0000 (-0800) Subject: Add the style element to the head rather than first element in the document, as the... X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=03e39363b61492e47cb9621616e6756f200f357d;p=pdf.js.git Add the style element to the head rather than first element in the document, as the first element could be a comment and this would line would then throw --- diff --git a/src/fonts.js b/src/fonts.js index 83ce4ab..1b959d6 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -2092,7 +2092,7 @@ var Font = (function FontClosure() { window.btoa(data) + ');'); var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}'; - document.documentElement.firstChild.appendChild( + document.documentElement.getElementsByTagName('head')[0].appendChild( document.createElement('style')); var styleSheet = document.styleSheets[document.styleSheets.length - 1];