Permalink
Browse files

fixed bug that occured when tmplCleanup gets called before MathJax's …

…typesetting finishes
  • Loading branch information...
1 parent 38645be commit b2d78efd18d4e0ec459d7e8c776e8476fbd78375 @tzjames tzjames committed Feb 5, 2013
Showing with 10 additions and 1 deletion.
  1. +10 −1 utils/tmpl.js
View
@@ -348,7 +348,16 @@ $.fn.tmplCleanup = function() {
} else {
KhanUtil.debugLog("no source element");
}
- jax.Remove();
+
+ if (e.previousSibling && e.previousSibling.className) {
+ jax.Remove();
+ } else {
+ // MathJax chokes if e.previousSibling is a text node, which it
+ // is if tmplCleanup is called before MathJax's typesetting
+ // finishes
+ KhanUtil.debugLog("previousSibling isn't an element");
+ }
+
KhanUtil.debugLog("removed!");
}
});

0 comments on commit b2d78ef

Please sign in to comment.