|
683 | 683 | // Get the data about the math
|
684 | 684 | //
|
685 | 685 | var jax = script.MathJax.elementJax, math = jax.root,
|
686 |
| - span = document.getElementById(jax.inputID+"-Frame"), |
| 686 | + span = script.previousSibling; |
687 | 687 | div = (jax.HTMLCSS.display ? (span||{}).parentNode : span);
|
688 | 688 | if (!div) return;
|
689 | 689 | //
|
|
775 | 775 | script = scripts[i];
|
776 | 776 | if (script && script.parentNode && script.MathJax.elementJax) {
|
777 | 777 | jax = script.MathJax.elementJax; this.getMetrics(jax);
|
778 |
| - jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.II); |
| 778 | + if (jax.HTMLCSS.span && jax.HTMLCSS.div) |
| 779 | + jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.II); |
779 | 780 | }
|
780 | 781 | }
|
781 | 782 | //
|
|
788 | 789 | // Finish the math with its measured size (toHTML phase III)
|
789 | 790 | //
|
790 | 791 | jax = script.MathJax.elementJax; this.getMetrics(jax);
|
791 |
| - jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.III); |
792 |
| - if (jax.HTMLCSS.isHidden) script.parentNode.insertBefore(jax.HTMLCSS.div,script); |
793 |
| - delete jax.HTMLCSS.span; delete jax.HTMLCSS.div; |
794 |
| - // |
795 |
| - // The math is now fully processed |
796 |
| - // |
797 |
| - script.MathJax.state = jax.STATE.PROCESSED; |
798 |
| - HUB.signal.Post(["New Math",script.MathJax.elementJax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback) |
| 792 | + if (jax.HTMLCSS.span && jax.HTMLCSS.div) { |
| 793 | + jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.III); |
| 794 | + if (jax.HTMLCSS.isHidden) script.parentNode.insertBefore(jax.HTMLCSS.div,script); |
| 795 | + delete jax.HTMLCSS.span; delete jax.HTMLCSS.div; |
| 796 | + // |
| 797 | + // The math is now fully processed |
| 798 | + // |
| 799 | + script.MathJax.state = jax.STATE.PROCESSED; |
| 800 | + HUB.signal.Post(["New Math",script.MathJax.elementJax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback) |
| 801 | + } |
799 | 802 | }
|
800 | 803 | }
|
801 | 804 | if (this.forceReflow) {
|
|
0 commit comments