commit b1a2b4fe0331ad0607e8289d7df04b0e5d17c2b5
parent cb13a059bbb4d302e11163200106f78595538326
Author: Davide P. Cervone <dpvc@union.edu>
Date: Wed, 11 Feb 2015 09:34:25 -0500
Don't cache the value of 'selected', since calls to isEmbellished() can be made before the expression is in place, and the values of displastyle and scriptlevel are known. Resolves issue #1053.
Diffstat:
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/unpacked/extensions/TeX/mathchoice.js b/unpacked/extensions/TeX/mathchoice.js
@@ -45,14 +45,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
MML.TeXmathchoice = MML.mbase.Subclass({
type: "TeXmathchoice", notParent: true,
- choice: function () {
- if (this.selection == null) {
- this.selection = 0;
- var values = this.getValues("displaystyle","scriptlevel");
- if (values.scriptlevel > 0) {this.selection = Math.min(3,values.scriptlevel+1)}
- else {this.selection = (values.displaystyle ? 0 : 1)}
- }
- return this.selection;
+ choice: function (nocache) {
+ var selection = 0, values = this.getValues("displaystyle","scriptlevel");
+ if (values.scriptlevel > 0) {selection = Math.min(3,values.scriptlevel+1)}
+ else {selection = (values.displaystyle ? 0 : 1)}
+ return selection;
},
selected: function () {return this.data[this.choice()]},
setTeXclass: function (prev) {return this.selected().setTeXclass(prev)},