diff --git a/books b/books
index e5b73d7..ab9755a 160000
--- a/books
+++ b/books
@@ -1 +1 @@
-Subproject commit e5b73d727bd3f073d330a195e4655be969ad12f0
+Subproject commit ab9755a74714b647290c861f666515de220935d8
diff --git a/examples/index.html b/examples/index.html
index 7f2223b..374e421 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -85,6 +85,7 @@
Promises
Fixed
Custom Element
+ MathML
diff --git a/hooks/default/mathml.js b/hooks/default/mathml.js
index 679b10f..60e45d6 100644
--- a/hooks/default/mathml.js
+++ b/hooks/default/mathml.js
@@ -2,15 +2,25 @@ EPUBJS.Hooks.register("beforeChapterDisplay").mathml = function(callback, render
// check of currentChapter properties contains 'mathml'
if(renderer.currentChapter.properties.indexOf("mathml") !== -1 ){
-
+
+ // Assign callback to be inside iframe window
+ renderer.iframe.contentWindow.mathmlCallback = callback;
+
// add MathJax config script tag to the renderer body
var s = document.createElement("script");
s.type = 'text/x-mathjax-config';
- s.innerHTML = 'MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"});';
+ s.innerHTML = '\
+ MathJax.Hub.Register.StartupHook("End",function () { \
+ console.log("The TeX input jax is loaded and ready!"); \
+ // window.mathmlCallback() \
+ });\
+ MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); \
+ ';
renderer.doc.body.appendChild(s);
-
// add MathJax.js to renderer head
EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML", null, renderer.doc.head);
+
+ } else {
+ if(callback) callback();
}
- if(callback) callback();
}