Index: trunk/phase3/resources/Resources.php |
— | — | @@ -726,6 +726,7 @@ |
727 | 727 | 'scripts' => 'resources/mediawiki.page/mediawiki.page.startup.js', |
728 | 728 | 'dependencies' => array( |
729 | 729 | 'jquery.client', |
| 730 | + 'mediawiki.util', |
730 | 731 | ), |
731 | 732 | 'position' => 'top', |
732 | 733 | ), |
Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.startup.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -( function( $ ) { |
| 2 | +( function ( $ ) { |
3 | 3 | |
4 | 4 | mw.page = {}; |
5 | 5 | |
— | — | @@ -8,4 +8,11 @@ |
9 | 9 | .addClass('client-js' ) |
10 | 10 | .removeClass( 'client-nojs' ); |
11 | 11 | |
| 12 | + // Initialize utilities as soon as the document is ready (mw.util.$content, |
| 13 | + // messageBoxNew, profile, tooltip access keys, Table of contents toggle, ..). |
| 14 | + // Enqueued into domready from here instead of mediawiki.page.ready to ensure that it gets enqueued |
| 15 | + // before other modules hook into document ready, so that mw.util.$content (defined by mw.util.init), |
| 16 | + // is defined for them. |
| 17 | + $( mw.util.init ); |
| 18 | + |
12 | 19 | } )( jQuery ); |
Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js |
— | — | @@ -1,8 +1,5 @@ |
2 | 2 | jQuery( document ).ready( function( $ ) { |
3 | 3 | |
4 | | - /* Initialize utilities (messageBoxNew, profile, tooltip access keys, TOC etc.) */ |
5 | | - mw.util.init(); |
6 | | - |
7 | 4 | /* Emulate placeholder if not supported by browser */ |
8 | 5 | if ( !( 'placeholder' in document.createElement( 'input' ) ) ) { |
9 | 6 | $( 'input[placeholder]' ).placeholder(); |