Update use of RegExp.$n to account for Firefoxs change from empty string to undefined for unmatched groups. Resolves issue #891.

This commit is contained in:
Davide P. Cervone 2014-08-19 13:35:11 -04:00
parent 3ca32dc64b
commit b33ed4c54b
3 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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

View File

@ -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;
},