From 61f36df18786c6f3992746e6731089652f7935d6 Mon Sep 17 00:00:00 2001 From: Matthew Flaschen Date: Thu, 14 Nov 2013 03:05:29 -0500 Subject: [PATCH] Document the wikipage.content hook There is some text in the mw.hook documentation section, but that's really intended to document mw.hook. Change-Id: I2afb74a1124123220b26b50b3df64dd7bae80208 --- resources/mediawiki.page/mediawiki.page.startup.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/mediawiki.page/mediawiki.page.startup.js b/resources/mediawiki.page/mediawiki.page.startup.js index 3846681878..e3541069d4 100644 --- a/resources/mediawiki.page/mediawiki.page.startup.js +++ b/resources/mediawiki.page/mediawiki.page.startup.js @@ -17,9 +17,20 @@ mw.util.init(); /** + * Fired when wiki content is being added to the DOM + * + * It is encouraged to fire it before the main DOM is changed (when $content + * is still detatched). However, this order is not defined either way, so you + * should only rely on $content itself. + * + * This includes the ready event on a page load (including post-edit loads) + * and when content has been previewed with LivePreview. + * * @event wikipage_content * @member mw.hook - * @param {jQuery} $content + * @param {jQuery} $content The most appropriate element containing the content, + * such as #mw-content-text (regular content root) or #wikiPreview (live preview + * root) */ mw.hook( 'wikipage.content' ).fire( $( '#mw-content-text' ) ); } ); -- 2.20.1