From fbfefac248ee588bfe36b145a2054d59c9a8bd22 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Thu, 26 Feb 2015 22:55:51 +0100 Subject: [PATCH] LivePreview: Use setTimeout to delay rendering of MathJax wikipage.content hook is fired before the new content is attached, but MathJax cannot deal with that. Use setTimeout to delay execution until next execution run. Bug: T90808 Change-Id: I02178bfd61d34dff49435f3a17a0ce385b37d14d --- modules/ext.math.mathjax.enabler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index 47cdf8a..0092344 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -225,7 +225,9 @@ } if ( MathJax.isReady ) { - render(); + // Call render asynchronous because live preview fires the hook with + // detached $content. See T90808 + setTimeout( render ); } else { mw.loader.using( 'ext.math.mathjax.mathjax', function () { MathJax.Hub.Startup.signal.MessageHook( 'End', render );