Fix WARNINGs generated by the MathJax packer. #534

This commit is contained in:
Frédéric Wang 2013-10-21 14:30:16 +02:00
parent b73eafd431
commit 90749a7afe
3 changed files with 15 additions and 13 deletions

View File

@ -61,6 +61,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
for (var i = 0, m = nl.length; i < m; i++) notation[nl[i]] = true;
if (notation[MML.NOTATION.UPDIAGONALARROW]) notation[MML.NOTATION.UPDIAGONALSTRIKE] = false;
var line;
for (var n in notation) {
if (!notation.hasOwnProperty(n) || !notation[n]) continue;
switch (n) {
@ -117,8 +118,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
break;
case MML.NOTATION.VERTICALSTRIKE:
var vline = HTMLCSS.createRule(stack,H+D-t/2,0,t);
HTMLCSS.addBox(stack,vline); HTMLCSS.placeBox(vline,p+t+base.bbox.w/2,-D,true);
line = HTMLCSS.createRule(stack,H+D-t/2,0,t);
HTMLCSS.addBox(stack,line); HTMLCSS.placeBox(line,p+t+base.bbox.w/2,-D,true);
break;
case MML.NOTATION.TOP:
@ -130,14 +131,14 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
break;
case MML.NOTATION.HORIZONTALSTRIKE:
var hline = HTMLCSS.createRule(stack,t,0,W-t/2);
HTMLCSS.addBox(stack,hline); HTMLCSS.placeBox(hline,0,(H+D)/2-D,true);
line = HTMLCSS.createRule(stack,t,0,W-t/2);
HTMLCSS.addBox(stack,line); HTMLCSS.placeBox(line,0,(H+D)/2-D,true);
break;
case MML.NOTATION.UPDIAGONALSTRIKE:
if (HTMLCSS.useVML) {
if (!vml) {vml = this.HTMLvml(stack,H,D,W,t,values.mathcolor)}
var line = this.HTMLvmlElement(vml,"line",{from: "0,"+this.HTMLpx(H+D-t), to: this.HTMLpx(W)+",0"});
line = this.HTMLvmlElement(vml,"line",{from: "0,"+this.HTMLpx(H+D-t), to: this.HTMLpx(W)+",0"});
} else {
if (!svg) {svg = this.HTMLsvg(stack,H,D,W,t,values.mathcolor)}
this.HTMLsvgElement(svg.firstChild,"line",{
@ -149,7 +150,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
case MML.NOTATION.UPDIAGONALARROW:
if (HTMLCSS.useVML) {
if (!vml) {vml = this.HTMLvml(stack,H,D,W,t,values.mathcolor)}
var line = this.HTMLvmlElement(vml,"line",{from: "0,"+this.HTMLpx(H+D-t), to: this.HTMLpx(W)+","+this.HTMLpx(t)});
line = this.HTMLvmlElement(vml,"line",{from: "0,"+this.HTMLpx(H+D-t), to: this.HTMLpx(W)+","+this.HTMLpx(t)});
this.HTMLvmlElement(line,"stroke",{endarrow:"classic"});
} else {
if (!svg) {svg = this.HTMLsvg(stack,H,D,W,t,values.mathcolor)}

View File

@ -902,6 +902,7 @@
MML.math.Augment({
toNativeMML: function (parent) {
var tag = this.NativeMMLelement(this.type), math = tag, jax;
var i, m;
nMML.adjustWidths = [];
//
// Some browsers don't seem to add the xmlns attribute, so do it by hand.
@ -916,7 +917,7 @@
//
// Add the children
//
for (var i = 0, m = this.data.length; i < m; i++) {
for (i = 0, m = this.data.length; i < m; i++) {
if (this.data[i]) {this.data[i].toNativeMML(tag)}
else {tag.appendChild(this.NativeMMLelement("mrow"))}
}
@ -969,8 +970,8 @@
// fix them up. Use ex's so that they print properly (see above).
//
var mtd = [];
for (var i = 0, m = nMML.adjustWidths.length; i < m; i++) {
var tag = nMML.adjustWidths[i];
for (i = 0, m = nMML.adjustWidths.length; i < m; i++) {
tag = nMML.adjustWidths[i];
var style = tag.getAttribute("style") || "";
if (!style.match(/(^|;)\s*min-width:/)) {
mtd.push(tag.scrollWidth);
@ -1215,11 +1216,11 @@
//
// Process the postscript pairs
//
var m = this.data.length, i;
var m = this.data.length, i, msubsup;
for (i = 1; i < m; i+=2) {
if (this.data[i].type === "mprescripts") break;
var msubsup = this.NativeMMLelement("msubsup");
msubsup = this.NativeMMLelement("msubsup");
msubsup.appendChild(base);
//
@ -1243,7 +1244,7 @@
// Process the prescript pairs
//
for (i++; i < m; i+=2) {
var msubsup = this.NativeMMLelement("msubsup");
msubsup = this.NativeMMLelement("msubsup");
msubsup.appendChild(this.NativeMMLelement("mrow"));
//

View File

@ -116,7 +116,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
// perform some reduction e.g. eliminate duplicate notations.
var nl = MathJax.Hub.SplitList(values.notation), notation = {};
for (var i = 0, m = nl.length; i < m; i++) notation[nl[i]] = true;
for (i = 0, m = nl.length; i < m; i++) notation[nl[i]] = true;
if (notation[MML.NOTATION.UPDIAGONALARROW]) notation[MML.NOTATION.UPDIAGONALSTRIKE] = false;
for (var n in notation) {