From b1a2b4fe0331ad0607e8289d7df04b0e5d17c2b5 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 11 Feb 2015 09:34:25 -0500 Subject: [PATCH] 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. --- unpacked/extensions/TeX/mathchoice.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/unpacked/extensions/TeX/mathchoice.js b/unpacked/extensions/TeX/mathchoice.js index 37a8509b2..eae6dc031 100644 --- 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)},