|
1082 | 1082 | while (this.i < this.string.length) {
|
1083 | 1083 | c = this.string.charAt(this.i++); n = c.charCodeAt(0);
|
1084 | 1084 | if (n >= 0xD800 && n < 0xDC00) {c += this.string.charAt(this.i++)}
|
1085 |
| - if (TEXDEF.special[c]) {this[TEXDEF.special[c]](c)} |
| 1085 | + if (TEXDEF.special.hasOwnProperty(c)) {this[TEXDEF.special[c]](c)} |
1086 | 1086 | else if (TEXDEF.letter.test(c)) {this.Variable(c)}
|
1087 | 1087 | else if (TEXDEF.digit.test(c)) {this.Number(c)}
|
1088 | 1088 | else {this.Other(c)}
|
|
1109 | 1109 | if (!isArray(macro)) {macro = [macro]}
|
1110 | 1110 | var fn = macro[0]; if (!(fn instanceof Function)) {fn = this[fn]}
|
1111 | 1111 | fn.apply(this,[c+name].concat(macro.slice(1)));
|
1112 |
| - } else if (TEXDEF.mathchar0mi[name]) {this.csMathchar0mi(name,TEXDEF.mathchar0mi[name])} |
1113 |
| - else if (TEXDEF.mathchar0mo[name]) {this.csMathchar0mo(name,TEXDEF.mathchar0mo[name])} |
1114 |
| - else if (TEXDEF.mathchar7[name]) {this.csMathchar7(name,TEXDEF.mathchar7[name])} |
1115 |
| - else if (TEXDEF.delimiter["\\"+name] != null) {this.csDelimiter(name,TEXDEF.delimiter["\\"+name])} |
1116 |
| - else {this.csUndefined(c+name)} |
| 1112 | + } else if (TEXDEF.mathchar0mi.hasOwnProperty(name)) {this.csMathchar0mi(name,TEXDEF.mathchar0mi[name])} |
| 1113 | + else if (TEXDEF.mathchar0mo.hasOwnProperty(name)) {this.csMathchar0mo(name,TEXDEF.mathchar0mo[name])} |
| 1114 | + else if (TEXDEF.mathchar7.hasOwnProperty(name)) {this.csMathchar7(name,TEXDEF.mathchar7[name])} |
| 1115 | + else if (TEXDEF.delimiter.hasOwnProperty("\\"+name)) {this.csDelimiter(name,TEXDEF.delimiter["\\"+name])} |
| 1116 | + else {this.csUndefined(c+name)} |
1117 | 1117 | },
|
1118 | 1118 | //
|
1119 | 1119 | // Look up a macro in the macros list
|
1120 | 1120 | // (overridden in begingroup extension)
|
1121 | 1121 | //
|
1122 |
| - csFindMacro: function (name) {return TEXDEF.macros[name]}, |
| 1122 | + csFindMacro: function (name) { |
| 1123 | + return (TEXDEF.macros.hasOwnProperty(name) ? TEXDEF.macros[name] : null); |
| 1124 | + }, |
1123 | 1125 | //
|
1124 | 1126 | // Handle normal mathchar (as an mi)
|
1125 | 1127 | //
|
|
1295 | 1297 | Other: function (c) {
|
1296 | 1298 | var def, mo;
|
1297 | 1299 | if (this.stack.env.font) {def = {mathvariant: this.stack.env.font}}
|
1298 |
| - if (TEXDEF.remap[c]) { |
| 1300 | + if (TEXDEF.remap.hasOwnProperty(c)) { |
1299 | 1301 | c = TEXDEF.remap[c];
|
1300 | 1302 | if (isArray(c)) {def = c[1]; c = c[0]}
|
1301 | 1303 | mo = MML.mo(MML.entity('#x'+c)).With(def);
|
|
1874 | 1876 | }
|
1875 | 1877 | this.Push(mml);
|
1876 | 1878 | },
|
1877 |
| - envFindName: function (name) {return TEXDEF.environment[name]}, |
| 1879 | + envFindName: function (name) { |
| 1880 | + return (TEXDEF.environment.hasOwnProperty(name) ? TEXDEF.environment[name] : null); |
| 1881 | + }, |
1878 | 1882 |
|
1879 | 1883 | Equation: function (begin,row) {return row},
|
1880 | 1884 |
|
|
1931 | 1935 | * Convert delimiter to character
|
1932 | 1936 | */
|
1933 | 1937 | convertDelimiter: function (c) {
|
1934 |
| - if (c) {c = TEXDEF.delimiter[c]} |
| 1938 | + if (c) {c = (TEXDEF.delimiter.hasOwnProperty(c) ? TEXDEF.delimiter[c] : null)} |
1935 | 1939 | if (c == null) {return null}
|
1936 | 1940 | if (isArray(c)) {c = c[0]}
|
1937 | 1941 | if (c.length === 4) {c = String.fromCharCode(parseInt(c,16))}
|
|
2043 | 2047 | this.i--;
|
2044 | 2048 | c = this.GetArgument(name).replace(/^\s+/,'').replace(/\s+$/,'');
|
2045 | 2049 | }
|
2046 |
| - if (TEXDEF.delimiter[c] != null) {return this.convertDelimiter(c)} |
| 2050 | + if (TEXDEF.delimiter.hasOwnProperty(c)) {return this.convertDelimiter(c)} |
2047 | 2051 | }
|
2048 | 2052 | TEX.Error(["MissingOrUnrecognizedDelim",
|
2049 | 2053 | "Missing or unrecognized delimiter for %1",name]);
|
|
0 commit comments