From b33ed4c54bacab96aae45e2f78ae20046f27bbad Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Tue, 19 Aug 2014 13:35:11 -0400 Subject: [PATCH] Update use of RegExp.$n to account for Firefoxs change from empty string to undefined for unmatched groups. Resolves issue #891. --- unpacked/extensions/toMathML.js | 2 +- unpacked/jax/output/HTML-CSS/autoload/mtable.js | 2 +- unpacked/jax/output/NativeMML/jax.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unpacked/extensions/toMathML.js b/unpacked/extensions/toMathML.js index e96c57327..4a0949f61 100644 --- a/unpacked/extensions/toMathML.js +++ b/unpacked/extensions/toMathML.js @@ -91,7 +91,7 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () { if (typeof(value) === "string" && value.replace(/ /g,"").match(/^(([-+])?(\d+(\.\d*)?|\.\d+))mu$/)) { // FIXME: should take scriptlevel into account - return RegExp.$2+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"; + return (RegExp.$2||"")+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"; } else if (this.toMathMLvariants[value]) {return this.toMathMLvariants[value]} return this.toMathMLquote(value); diff --git a/unpacked/jax/output/HTML-CSS/autoload/mtable.js b/unpacked/jax/output/HTML-CSS/autoload/mtable.js index ab2480352..d4f03d1bb 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/mtable.js +++ b/unpacked/jax/output/HTML-CSS/autoload/mtable.js @@ -167,7 +167,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { var Y, fY, n = ""; if (typeof(values.align) !== "string") {values.align = String(values.align)} if (values.align.match(/(top|bottom|center|baseline|axis)( +(-?\d+))?/)) - {n = RegExp.$3; values.align = RegExp.$1} else {values.align = this.defaults.align} + {n = RegExp.$3||""; values.align = RegExp.$1} else {values.align = this.defaults.align} if (n !== "") { // // Find the height of the given row diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.js index 7a1212e6b..a693afbf0 100644 --- a/unpacked/jax/output/NativeMML/jax.js +++ b/unpacked/jax/output/NativeMML/jax.js @@ -518,7 +518,7 @@ value = String(value); if (nMML.NAMEDSPACE[value]) {value = nMML.NAMEDSPACE[value]} // MP doesn't do negative spaces else if (value.match(/^\s*(([-+])?(\d+(\.\d*)?|\.\d+))\s*mu\s*$/)) - {value = RegExp.$2+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"} // FIXME: should take scriptlevel into account + {value = (RegExp.$2||"")+((1/18)*RegExp.$3).toFixed(3).replace(/\.?0+$/,"")+"em"} // FIXME: should take scriptlevel into account else if (this.NativeMMLvariants[value]) {value = this.NativeMMLvariants[value]} return value; },