From fae3c02bb2c340a652d726bfdda171788f286580 Mon Sep 17 00:00:00 2001 From: "Cheng-Han, Wu" Date: Wed, 24 Feb 2016 10:57:33 +0800 Subject: [PATCH] Fixed mathjax queue might parse whole page if pass an empty or single item array --- public/js/extra.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/extra.js b/public/js/extra.js index 200a4652..a82a53c2 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -208,8 +208,13 @@ function finishView(view) { //mathjax var mathjaxdivs = view.find('.mathjax.raw').removeClass("raw").toArray(); try { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs]); - MathJax.Hub.Queue(viewAjaxCallback); + if (mathjaxdivs.length > 1) { + MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs]); + MathJax.Hub.Queue(viewAjaxCallback); + } else if (mathjaxdivs.length > 0) { + MathJax.Hub.Queue(["Typeset", MathJax.Hub, mathjaxdivs[0]]); + MathJax.Hub.Queue(viewAjaxCallback); + } } catch (err) {} //sequence diagram var sequences = view.find(".sequence-diagram.raw").removeClass("raw");