Skip to content

Commit 20e1e01

Browse files
committed
Merge branch 'issue1016' into develop. Issue #1016.
2 parents 8f9d982 + 6465686 commit 20e1e01

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

unpacked/MathJax.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ MathJax.cdnFileVersions = {}; // can be used to specify revisions for indi
641641
if (document.styleSheets && document.styleSheets.length > sheets)
642642
{sheets = document.styleSheets.length}
643643
if (!head) {
644-
head = (document.getElementsByTagName("head"))[0];
644+
head = document.head || ((document.getElementsByTagName("head"))[0]);
645645
if (!head) {head = document.body}
646646
}
647647
return head;
@@ -3038,9 +3038,11 @@ MathJax.Hub.Startup = {
30383038
if (!BASE) {BASE = window[BASENAME] = {}}
30393039

30403040
var HUB = BASE.Hub; var STARTUP = HUB.Startup; var CONFIG = HUB.config;
3041-
var HEAD = document.getElementsByTagName("head")[0];
3041+
var HEAD = document.head || (document.getElementsByTagName("head")[0]);
30423042
if (!HEAD) {HEAD = document.childNodes[0]};
30433043
var scripts = (document.documentElement || document).getElementsByTagName("script");
3044+
if (scripts.length === 0 && HEAD.namespaceURI)
3045+
scripts = document.getElementsByTagNameNS(HEAD.namespaceURI,"script");
30443046
var namePattern = new RegExp("(^|/)"+BASENAME+"\\.js(\\?.*)?$");
30453047
for (var i = scripts.length-1; i >= 0; i--) {
30463048
if ((scripts[i].src||"").match(namePattern)) {
@@ -3168,7 +3170,7 @@ MathJax.Hub.Startup = {
31683170
if (browser.hasMathPlayer) {
31693171
var mathplayer = document.createElement("object");
31703172
mathplayer.id = "mathplayer"; mathplayer.classid = "clsid:32F66A20-7614-11D4-BD11-00104BD3F987";
3171-
document.getElementsByTagName("head")[0].appendChild(mathplayer);
3173+
HEAD.appendChild(mathplayer);
31723174
document.namespaces.add("m","http://www.w3.org/1998/Math/MathML");
31733175
browser.mpNamespace = true;
31743176
if (document.readyState && (document.readyState === "loading" ||

0 commit comments

Comments
 (0)