diff -ur jsMath-2.3b-lowercase-mozfix/jsMath-controls.html jsMath-2.3b-xhtml/jsMath-controls.html --- jsMath-2.3b-lowercase-mozfix/jsMath-controls.html 2005-10-31 08:41:27.000000000 -0800 +++ jsMath-2.3b-xhtml/jsMath-controls.html 2005-10-31 08:41:22.000000000 -0800 @@ -76,7 +76,7 @@ Main: function () { this.oldCookie = {}; jsMath.Add(this.oldCookie,this.cookie); this.panel.innerHTML = ""; // for MSIE on the Mac - this.panel.innerHTML = document.getElementById("jsMath.panel").innerHTML; + this.panel.appendChild(document.getElementById("jsMath.panel").cloneNode(true)); jsMath.Element("fontType").innerHTML = ({tex:"TeX", @@ -109,7 +109,7 @@ Options: function () { this.panel.innerHTML = ""; // for MSIE on the Mac - this.panel.innerHTML = document.getElementById("jsMath.options").innerHTML; + this.panel.appendChild(document.getElementById("jsMath.options").cloneNode(true)); jsMath.Element("scale").value = this.cookie.scale; jsMath.Element("keep").value = this.cookie.keep; for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1}) { diff -ur jsMath-2.3b-lowercase-mozfix/jsMath.js jsMath-2.3b-xhtml/jsMath.js --- jsMath-2.3b-lowercase-mozfix/jsMath.js 2005-10-31 08:41:28.000000000 -0800 +++ jsMath-2.3b-xhtml/jsMath.js 2005-10-31 09:03:22.000000000 -0800 @@ -289,7 +289,9 @@ */ Script: function (file) { if (!file.match('^([a-zA-Z]+:/)?/')) {file = jsMath.root + file} - document.write(''); + var loader = document.createElement("script"); + loader.src = file; + document.getElementsByTagName('body')[0].appendChild(loader); }, /* @@ -297,7 +299,7 @@ */ HTML: function () { jsMath.hidden = this.TopHTML("Hidden",{'class':"normal"},{ - position:"absolute", top:0, left:0, border:0, padding:0, margin:0 + position:"absolute", top:0, left:0, border:0, padding:0, margin:0 }); return; }, @@ -413,9 +415,10 @@ styles = jsMath.styles; styles['.jsM_scale'] = 'font-size:'+jsMath.Controls.cookie.scale+'%'; } - document.writeln(''); + var style = '' + jsMath.writehead(style); }, /* @@ -437,7 +440,7 @@ jsMath.Setup.User(); // do user-specific initialization //make sure browser-specific loads are done before this - document.write(''); + jsMath.write(''); this.inited = 1; }, @@ -996,7 +999,7 @@ if (!jsMath.Browser.msieButtonBug) {this.Button()} else {setTimeout("jsMath.Controls.Button()",500)} if (jsMath.Browser.safariIFRAMEbug) { - document.write( + jsMath.write( '\n'); } @@ -2078,7 +2081,7 @@ if (window.location.protocol != 'file:') {jsMath.Controls.SetCookie(0)} if (jsMath.Browser.alphaPrintBug) {jsMath.Controls.cookie.alpha = 0} } - document.writeln(''); + jsMath.write(''); this.loaded = 1; } @@ -2099,9 +2102,11 @@ * using 0 when the value is near zero. */ Em: function (m) { + //if(isnan(m)) { alert("jsMath.HTML.Em passed a NaN"); } var n = 5; if (m < 0) {n++} if (Math.abs(m) < .000001) {m = 0} var s = String(m); s = s.replace(/(\.\d\d\d).+/,'$1'); + //alert("Em("+m+")="+s+"em"); return s+'em' }, @@ -5297,11 +5302,16 @@ } else if (name.match(/withdelims$/)) { this.mlist.data.overF.left = this.GetDelimiter(this.cmd+name); if (this.error) return; this.mlist.data.overF.right = this.GetDelimiter(this.cmd+name); if (this.error) return; + } else { + this.mlist.data.overF.left = null; + this.mlist.data.overF.right = null; } if (name.match(/^above/)) { this.mlist.data.overF.thickness = this.GetDimen(this.cmd.name,1); if (this.error) return; + } else { + this.mlist.data.overF.thickness = null; } }, @@ -5675,6 +5685,32 @@ /* * Initialize everything */ + +jsMath.domparser = new DOMParser(); +try { + document.write(""); + jsMath.write = function(s) { document.write(s); } + jsMath.writehead = function(s) { document.write(s); } +} +catch(err) { + jsMath.write = function(s) { + var newelement = jsMath.domparser.parseFromString( + '' + +s+'','application/xhtml+xml'); + var appendme = newelement.firstChild.firstChild.firstChild; // node is + // Document, child is html, child of child is body, child of child of + // child is the requested text. + document.getElementsByTagName('body')[0].appendChild(appendme); + } + jsMath.writehead = function(s) { + var newelement = (new DOMParser()).parseFromString( + '' + +s+'','application/xhtml+xml'); + var appendme = newelement.firstChild.firstChild.firstChild; + document.getElementsByTagName('head')[0].appendChild(appendme); + } +} + jsMath.Loaded(); jsMath.Controls.GetCookie(); if (document.body) {jsMath.Setup.Body()} Only in jsMath-2.3b-xhtml/: .jsMath.js.swl Only in jsMath-2.3b-xhtml/: .jsMath.js.swm Only in jsMath-2.3b-xhtml/: .jsMath.js.swn Only in jsMath-2.3b-xhtml/: .jsMath.js.swo Only in jsMath-2.3b-xhtml/: .jsMath.js.swp