From 3b35ca9e1665dd280e16896be7a5215662af75ad Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Thu, 6 Feb 2014 13:18:04 -0500 Subject: [PATCH 1/2] Add more tests to check that the math is still in the page. Should resolve issue #730 (though we don't have their page and can't really test it). --- unpacked/jax/output/HTML-CSS/jax.js | 3 ++- unpacked/jax/output/NativeMML/jax.js | 4 ++-- unpacked/jax/output/SVG/jax.js | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index 6ece947af..ba2447e34 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -579,7 +579,8 @@ // var jax = script.MathJax.elementJax, math = jax.root, span = document.getElementById(jax.inputID+"-Frame"), - div = (jax.HTMLCSS.display ? span.parentNode : span); + div = (jax.HTMLCSS.display ? (span||{}).parentNode : span); + if (!span || !div) return; // // Set the font metrics // diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.js index 7e38c035e..74e7224c4 100644 --- a/unpacked/jax/output/NativeMML/jax.js +++ b/unpacked/jax/output/NativeMML/jax.js @@ -286,8 +286,8 @@ // Get the jax and the container and set the size // var jax = script.MathJax.elementJax, math = jax.root; - var span = document.getElementById(jax.inputID+"-Frame"), - container = span.firstChild, mspan = container.firstChild; + var span = document.getElementById(jax.inputID+"-Frame"); if (!span) return; + var container = span.firstChild, mspan = container.firstChild; this.ex = jax.NativeMML.ex || this.defaultEx; this.scale = jax.NativeMML.scale || 1; if (this.scale !== 1) {span.style.fontSize = jax.NativeMML.fontSize} diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index 7a44aeee0..6c46ee18a 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -289,7 +289,8 @@ // var jax = script.MathJax.elementJax, math = jax.root, span = document.getElementById(jax.inputID+"-Frame"), - div = (jax.SVG.display ? span.parentNode : span); + div = (jax.SVG.display ? (span||{}).parentNode : span); + if (!span || !div) return; // // Set the font metrics // From f1f109b586d52251c6ba4b6ebdd651b22ec49333 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Fri, 7 Feb 2014 09:39:56 -0500 Subject: [PATCH 2/2] Remove redundent check (if span is null, then div will be null, so only need to check for div). Issue #730. --- unpacked/jax/output/HTML-CSS/jax.js | 2 +- unpacked/jax/output/SVG/jax.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index ba2447e34..676a034cd 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -580,7 +580,7 @@ var jax = script.MathJax.elementJax, math = jax.root, span = document.getElementById(jax.inputID+"-Frame"), div = (jax.HTMLCSS.display ? (span||{}).parentNode : span); - if (!span || !div) return; + if (!div) return; // // Set the font metrics // diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js index 6c46ee18a..389386e91 100644 --- a/unpacked/jax/output/SVG/jax.js +++ b/unpacked/jax/output/SVG/jax.js @@ -290,7 +290,7 @@ var jax = script.MathJax.elementJax, math = jax.root, span = document.getElementById(jax.inputID+"-Frame"), div = (jax.SVG.display ? (span||{}).parentNode : span); - if (!span || !div) return; + if (!div) return; // // Set the font metrics //