www

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

commit 70d5bfa55e353360cb8ba937652a1b62559ea0fa
parent afb577643fd4a663089d82075c0496d0731f1064
Author: Georges Dupéron <georges.duperon@gmail.com>
Date:   Thu, 13 Jul 2017 11:13:41 +0200

Avoid inserting a large div without hiding it under an `overflow: hidden` wrapper, as it could make a scrollbar pop for a short amount of time, and could affect the page-size detection of mobile browsers, as explained here: https://github.com/mathjax/MathJax-node/issues/204#issuecomment-314870681

Diffstat:
Mrun-mathjax-offline.node.js | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/run-mathjax-offline.node.js b/run-mathjax-offline.node.js @@ -71,7 +71,7 @@ jsdom.env('doc/phc-thesis/index.html', function(err, window) { } }; // Fix the font size (mathjax-node cannot know easily the webpage's font size in advance). - var patchFontSizeCode = "(function() { var d = document.createElement('div'); d.style.width = '2260ex'; document.body.appendChild(d); window.setTimeout(function() { var sz = d.clientWidth / 1000; document.body.removeChild(d); if (sz > 3) { var st = document.createElement('style'); st.appendChild(document.createTextNode('html .mjx-chtml { font-size: '+sz+'px; } html .mjx-chtml .mjx-chtml {font-size: inherit }')); document.head.appendChild(st); } }, 0)})();"; + var patchFontSizeCode = "(function() { var outer = document.createElement('div'); outer.style.width = '0px'; outer.style.height = '0px'; outer.style.overflow = 'hidden'; var d = document.createElement('div'); d.style.width = '2260ex'; outer.appendChild(d); document.body.appendChild(outer); window.setTimeout(function() { var sz = d.clientWidth / 1000; document.body.removeChild(outer); if (sz > 3) { var st = document.createElement('style'); st.appendChild(document.createTextNode('html .mjx-chtml { font-size: '+sz+'px; } html .mjx-chtml .mjx-chtml { font-size: inherit; }')); document.head.appendChild(st); } }, 0)})();"; var patchFontSize = window.document.createElement('script'); patchFontSize.appendChild(window.document.createTextNode(patchFontSizeCode)); patchFontSize.setAttribute('type', 'text/javascript');