I've done a little more work on trying to figure out what is going on, and I have a slightly better understanding (but only slightly better). The HTML-CSS output jax is stored as an object that has a number of properties, something like {id:"HTML-CSS", version:"2.2", fontDirectory: ...}. At some point during the processing of the mathematics, Chrome loses track of the mapping of the property names to their values. In particular, it seems to shift them all down by one position (so version now is associated with "HTML-CSS", and fontDirectory with "2.2", and so on). So it looks like an index that is used to address the properties gets off by one. But the first time one of the properties is accessed, the pointer gets fixed, and subsequent requests get the correct value (version is again attached to "2.2", etc.).
The mixup seems to occur when MathJax.Hub.saveScript() is called. If I put a console.log(MathJax.OutputJax["HTML-CSS"].version) just before the call to MathJax.Hub.saveScript() is made, the value is OK, but the same console.log() message as the first command inside the saveScript() function shows the shifted value (the value of the id property). None of the values that are passed to MathJax.Hub.saveScript() are related to MathJax.OutputJax, and the HTML-CSS output jax is not even created at the point that the saveScript function is defined, so the HTML-CSS object is not include in a closer for saveScript(). So I'm at a loss as to why there would be any effect on the HTML-CSS output Jax when calling the saveScript() routine, but it is pretty clear that there is one.
If you want to see it yourself, you can add
MathJax.Hub.SAVESCRIPT = MathJax.Hub.saveScript;
MathJax.Hub.saveScript = function () {
var HTMLCSS = MathJax.OutputJax["HTML-CSS"];
console.log([HTMLCSS.version,HTMLCSS.version,HTMLCSS.id]);
return this.SAVESCRIPT.apply(this,arguments);
}
at the bottom of your text/x-mathjax-config block in the page that is showing the problem. This traps the saveScript() function and prints the value of the version property (twice) and the id property from the HTML-CSS output jax every time saveScript() is called. (That will be a LOT of times.) The first two values should be the same, but you will see that about half way through, the first occurrence changes from "2.2" to "HTML-CSS" (the version becomes the id). But the second version is correct (the first reference has cured the problem).
Anyway, it is very strange. Perhaps it would be possible to submit the page with this extra configuration code as a bug report to Chrome, but I wouldn't hold my breath.
Davide
On Oct 22, 2013, at 7:11 AM, Jason Grout wrote: