mediawiki.action.edit.preview: Fix for LiquidThreads hack
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 8 Oct 2013 19:40:00 +0000 (21:40 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 8 Oct 2013 20:04:07 +0000 (22:04 +0200)
LiquidThreads is loading this core module when rendering an
inline edit form. Because the form doesn't have the same ID
as the one in core, this broke after becd284.

It previously worked because the click event on the button (of
which LQT did duplicate the ID from core) bubbles up to the
document body and thus trigger this private handler of the
core edit preview module.

Change-Id: I9e35d0c48b86e1c9073b68313a8a330c6ea85b86

resources/mediawiki.action/mediawiki.action.edit.preview.js

index d9ab979..c5cd61e 100644 (file)
                        );
                }
 
-               $( '#editform' ).on( 'click', '#wpPreview, #wpDiff', doLivePreview );
+               // This should be moved down to '#editform', but is kept on the body for now
+               // because the LiquidThreads extension is re-using this module with only half
+               // the EditPage (doesn't include #editform presumably, bug 55463).
+               $( document.body ).on( 'click', '#wpPreview, #wpDiff', doLivePreview );
        } );
 
 }( mediaWiki, jQuery ) );