Add checks to make sure that the math hasn't been removed from the page. (Resolves issue #1384.)

This commit is contained in:
Davide P. Cervone 2016-03-20 11:48:12 -04:00
parent 11cd99bd7c
commit 3183eca200
2 changed files with 3 additions and 3 deletions
unpacked

View File

@ -2182,7 +2182,7 @@ MathJax.Hub = {
// //
// Check if already processed or needs processing // Check if already processed or needs processing
// //
if (!script.MathJax || script.MathJax.state === STATE.PROCESSED) {state.i++; continue}; if (!script.parentNode || !script.MathJax || script.MathJax.state === STATE.PROCESSED) {state.i++; continue};
if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) { if (!script.MathJax.elementJax || script.MathJax.state === STATE.UPDATE) {
this.checkScriptSiblings(script); // remove preJax/postJax etc. this.checkScriptSiblings(script); // remove preJax/postJax etc.
var type = script.type.replace(/ *;(.|\s)*/,""); // the input jax type var type = script.type.replace(/ *;(.|\s)*/,""); // the input jax type
@ -2286,7 +2286,7 @@ MathJax.Hub = {
// Check that there is an element jax // Check that there is an element jax
// //
script = state.scripts[state.i]; script = state.scripts[state.i];
if (!script || !script.MathJax || script.MathJax.error) {state.i++; continue} if (!script || !script.parentNode || !script.MathJax || script.MathJax.error) {state.i++; continue}
var jax = script.MathJax.elementJax; if (!jax) {state.i++; continue} var jax = script.MathJax.elementJax; if (!jax) {state.i++; continue}
// //
// Call the output Jax's Process method (which will be its Translate() // Call the output Jax's Process method (which will be its Translate()

View File

@ -100,7 +100,7 @@
// and call the PreviewHTML output jax to create the preview // and call the PreviewHTML output jax to create the preview
// //
Preview: function (data) { Preview: function (data) {
if (!this.Active()) return; if (!this.Active() || !data.script.parentNode) return;
var preview = data.script.MathJax.preview || data.script.previousSibling; var preview = data.script.MathJax.preview || data.script.previousSibling;
if (!preview || preview.className !== MathJax.Hub.config.preRemoveClass) { if (!preview || preview.className !== MathJax.Hub.config.preRemoveClass) {
preview = HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass}); preview = HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});