Skip to content

Commit b8a48d9

Browse files
committed
Properly measure final HTML-CSS output to make sure we have the right size. Resolves issue #1158.
1 parent 48b594a commit b8a48d9

File tree

1 file changed

+13
-10
lines changed
  • unpacked/jax/output/HTML-CSS

1 file changed

+13
-10
lines changed

unpacked/jax/output/HTML-CSS/jax.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,18 @@
726726
postTranslate: function (state,partial) {
727727
var scripts = state.jax[this.id], script, jax, i, m;
728728
//
729-
// Merasure the math in this chunk (toHTML phase II)
729+
// Remove the processed markers so that measuring can occur,
730+
// and remove the preview, if any, since the math will now be visible.
731+
//
732+
for (i = state.HTMLCSSlast, m = state.HTMLCSSeqn; i < m; i++) {
733+
script = scripts[i];
734+
if (script && script.MathJax.elementJax) {
735+
script.previousSibling.className = script.previousSibling.className.split(/ /)[0];
736+
if (script.MathJax.preview) {script.MathJax.preview.innerHTML = ""}
737+
}
738+
}
739+
//
740+
// Measure the math in this chunk (toHTML phase II)
730741
//
731742
for (i = state.HTMLCSSlast, m = state.HTMLCSSeqn; i < m; i++) {
732743
script = scripts[i];
@@ -752,14 +763,6 @@
752763
//
753764
script.MathJax.state = jax.STATE.PROCESSED;
754765
HUB.signal.Post(["New Math",script.MathJax.elementJax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback)
755-
//
756-
// Remove the processed marker
757-
//
758-
script.previousSibling.className = script.previousSibling.className.split(/ /)[0];
759-
//
760-
// Remove the preview, if any
761-
//
762-
if (script.MathJax.preview) {script.MathJax.preview.innerHTML = ""}
763766
}
764767
}
765768
if (this.forceReflow) {
@@ -2865,7 +2868,7 @@
28652868
MML.mbase.prototype.displayIndent = HUB.config.displayIndent;
28662869
if (String(HUB.config.displayIndent).match(/^0($|[a-z%])/i))
28672870
MML.mbase.prototype.displayIndent = "0";
2868-
html = this.data[0].toHTML(box); html.bbox.exactW = true; // force remeasure just to be sure
2871+
html = this.data[0].toHTML(box); html.bbox.exactW = false; // force remeasure just to be sure
28692872
}
28702873
} else {
28712874
span = span.firstChild.firstChild;

0 commit comments

Comments
 (0)