From: Andrew Garrett Date: Sat, 15 Sep 2012 14:14:27 +0000 (+0200) Subject: LivePreview: bind a delegated click event for #wpPreview/Diff X-Git-Tag: 1.31.0-rc.0~22322^2 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=91fca211d842d75f224ff2801feb7c00ca16a614;p=lhc%2Fweb%2Fwiklou.git LivePreview: bind a delegated click event for #wpPreview/Diff This makes it work with edit forms added to the page after it is loaded, e.g. by an extension (like LiquidThreads). Change-Id: Ia9673a754c871baea82bb28ded7b19e2608d9d03 --- diff --git a/skins/common/preview.js b/skins/common/preview.js index c88272d3d0..5b5a3c643f 100644 --- a/skins/common/preview.js +++ b/skins/common/preview.js @@ -101,6 +101,6 @@ // (mw.loader takes care of stuff if they happen to be loaded already) mw.loader.load( 'mediawiki.action.history.diff' ); - $( '#wpPreview, #wpDiff' ).click( doLivePreview ); + $( document.body ).on( 'click', '#wpPreview, #wpDiff', doLivePreview ); } ); } )( mediaWiki, jQuery );