Skip to content

Commit b1a2b4f

Browse files
committed
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.
1 parent cb13a05 commit b1a2b4f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

unpacked/extensions/TeX/mathchoice.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,11 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
4545

4646
MML.TeXmathchoice = MML.mbase.Subclass({
4747
type: "TeXmathchoice", notParent: true,
48-
choice: function () {
49-
if (this.selection == null) {
50-
this.selection = 0;
51-
var values = this.getValues("displaystyle","scriptlevel");
52-
if (values.scriptlevel > 0) {this.selection = Math.min(3,values.scriptlevel+1)}
53-
else {this.selection = (values.displaystyle ? 0 : 1)}
54-
}
55-
return this.selection;
48+
choice: function (nocache) {
49+
var selection = 0, values = this.getValues("displaystyle","scriptlevel");
50+
if (values.scriptlevel > 0) {selection = Math.min(3,values.scriptlevel+1)}
51+
else {selection = (values.displaystyle ? 0 : 1)}
52+
return selection;
5653
},
5754
selected: function () {return this.data[this.choice()]},
5855
setTeXclass: function (prev) {return this.selected().setTeXclass(prev)},

0 commit comments

Comments
 (0)