Skip to content

Commit 094b139

Browse files
committed
Merge pull request #1456 from dpvc/issue1384
Fix problems from puzzling.SE. #1384.
2 parents 1d84967 + fc1d3d4 commit 094b139

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

unpacked/MathJax.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ MathJax.Hub = {
21822182
//
21832183
// Check if already processed or needs processing
21842184
//
2185-
if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) {state.i++; continue};
2185+
if (!script.parentNode || !script.MathJax || script.MathJax.state === STATE.PROCESSED) {state.i++; continue};
21862186
if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) {
21872187
this.checkScriptSiblings(script); // remove preJax/postJax etc.
21882188
var type = script.type.replace(/ *;(.|\s)*/,""); // the input jax type
@@ -2286,7 +2286,7 @@ MathJax.Hub = {
22862286
// Check that there is an element jax
22872287
//
22882288
script = state.scripts[state.i];
2289-
if (!script || !script.MathJax || script.MathJax.error) {state.i++; continue}
2289+
if (!script || !script.parentNode || !script.MathJax || script.MathJax.error) {state.i++; continue}
22902290
var jax = script.MathJax.elementJax; if (!jax) {state.i++; continue}
22912291
//
22922292
// Call the output Jax's Process method (which will be its Translate()

unpacked/extensions/fast-preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
// and call the PreviewHTML output jax to create the preview
101101
//
102102
Preview: function (data) {
103-
if (!this.Active()) return;
103+
if (!this.Active() || !data.script.parentNode) return;
104104
var preview = data.script.MathJax.preview || data.script.previousSibling;
105105
if (!preview || preview.className !== MathJax.Hub.config.preRemoveClass) {
106106
preview = HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -745,9 +745,9 @@
745745
//
746746
for (i = state.HTMLCSSlast, m = state.HTMLCSSeqn; i < m; i++) {
747747
script = scripts[i];
748-
if (script && script.MathJax.elementJax) {
749-
var div = script.MathJax.elementJax.HTMLCSS.div;
750-
div.className = div.className.split(/ /)[0];
748+
if (script && script.parentNode && script.MathJax.elementJax) {
749+
var div = (script.MathJax.elementJax.HTMLCSS||{}).div;
750+
if (div) {div.className = div.className.split(/ /)[0]}
751751
if (script.MathJax.preview) {script.MathJax.preview.innerHTML = ""}
752752
}
753753
}
@@ -756,7 +756,7 @@
756756
//
757757
for (i = state.HTMLCSSlast, m = state.HTMLCSSeqn; i < m; i++) {
758758
script = scripts[i];
759-
if (script && script.MathJax.elementJax) {
759+
if (script && script.parentNode && script.MathJax.elementJax) {
760760
jax = script.MathJax.elementJax; this.getMetrics(jax);
761761
jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.II);
762762
}
@@ -766,7 +766,7 @@
766766
//
767767
for (i = state.HTMLCSSlast, m = state.HTMLCSSeqn; i < m; i++) {
768768
script = scripts[i];
769-
if (script && script.MathJax.elementJax) {
769+
if (script && script.parentNode && script.MathJax.elementJax) {
770770
//
771771
// Finish the math with its measured size (toHTML phase III)
772772
//

unpacked/jax/output/PlainSource/jax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
// Remove any existing output
6666
//
6767
prev = script.previousSibling;
68-
if (prev && String(prev.className).match(/^MathJax_PlainSource(_Display)?( MathJax_Processing)?$/)) {
68+
if (prev && String(prev.className).match(/^MathJax(_PlainSource)?(_Display)?( MathJax_Process(ing|ed))?$/)) {
6969
prev.parentNode.removeChild(prev);
7070
}
7171
//

unpacked/jax/output/PreviewHTML/jax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
// Remove any existing output
186186
//
187187
prev = script.previousSibling;
188-
if (prev && String(prev.className).match(/^MathJax_PHTML(_Display)?( MathJax_Processing)?$/))
188+
if (prev && String(prev.className).match(/^MathJax(_PHTML)?(_Display)?( MathJax_Process(ing|ed))?$/))
189189
{prev.parentNode.removeChild(prev)}
190190
//
191191
// Add the span, and a div if in display mode,

unpacked/jax/output/SVG/jax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
// Remove any existing output
208208
//
209209
prev = script.previousSibling;
210-
if (prev && String(prev.className).match(/^MathJax(_SVG)?(_Display)?( MathJax(_SVG)?_Processing)?$/))
210+
if (prev && String(prev.className).match(/^MathJax(_SVG)?(_Display)?( MathJax(_SVG)?_Process(ing|ed))?$/))
211211
{prev.parentNode.removeChild(prev)}
212212
//
213213
// Add the span, and a div if in display mode,

0 commit comments

Comments
 (0)