Fixed mathjax queue might parse whole page if pass an empty or single item array

This commit is contained in:
Cheng-Han, Wu 2016-02-24 10:57:33 +08:00
parent daf4c9dcae
commit fae3c02bb2

View file

@ -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");