www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 4d0af10b8d71c8624a357127acf6f77218b59781
parent 3ba60663dfc6efd0269b1aab5250549e6fe5f5e8
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Mon, 25 Jan 2016 12:02:24 -0500

If measurements can't be taken in getHDW(), move the test elements to the document.body instead in hopes that it is visible.  Resolves issue #1353.

Diffstat:
Munpacked/jax/output/CommonHTML/jax.js | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js @@ -858,10 +858,17 @@ var test2 = CHTML.addElement(CHTML.CHTMLnode,"mjx-chartest",{className:name},[["mjx-char",{style:styles},[c,["mjx-box"]]]]); test1.firstChild.style.fontSize = test2.firstChild.style.fontSize = ""; var em = 5*CHTML.em; - var d = (test2.offsetHeight-1000)/em; - var w = test1.offsetWidth/em, h = test1.offsetHeight/em - d; + var H1 = test1.offsetHeight, H2 = test2.offsetHeight, W = test1.offsetWidth; CHTML.CHTMLnode.removeChild(test1); CHTML.CHTMLnode.removeChild(test2); + if (H2 === 0) { + em = 5*CHTML.defaultEm; + var test = document.body.appendChild(document.createElement("div")); + test.appendChild(test1); test.appendChild(test2); + H1 = test1.offsetHeight, H2 = test2.offsetHeight, W = test1.offsetWidth; + document.body.removeChild(test); + } + var d = (H2-1000)/em, w = W/em, h = H1/em - d; return {h:h, d:d, w:w} },