mw.loader: Omit private modules from the request queue
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.jqueryMsg.js
index b5c2dba..66d560e 100644 (file)
                        magic: {
                                'SITENAME': mw.config.get( 'wgSiteName' )
                        },
-                       // This is a whitelist based on, but simpler than, Sanitizer.php.
+                       // Whitelist for allowed HTML elements in wikitext.
                        // Self-closing tags are not currently supported.
-                       allowedHtmlElements: [
-                               'b',
-                               'i'
-                       ],
+                       // Can be populated via setPrivateData().
+                       allowedHtmlElements: [],
                        // Key tag name, value allowed attributes for that tag.
                        // See Sanitizer::setupAttributeWhitelist
                        allowedHtmlCommonAttributes: [
 
        mw.jqueryMsg = {};
 
+       /**
+        * Initialize parser defaults.
+        *
+        * ResourceLoaderJqueryMsgModule calls this to provide default values from
+        * Sanitizer.php for allowed HTML elements. To override this data for individual
+        * parsers, pass the relevant options to mw.jqueryMsg.parser.
+        *
+        * @private
+        * @param {Object} data
+        */
+       mw.jqueryMsg.setParserDefaults = function ( data ) {
+               if ( data.allowedHtmlElements ) {
+                       parserDefaults.allowedHtmlElements = data.allowedHtmlElements;
+               }
+       };
+
        /**
         * Returns a function suitable for use as a global, to construct strings from the message key (and optional replacements).
         * e.g.
         *
-        *       window.gM = mediaWiki.parser.getMessageFunction( options );
+        *       window.gM = mediaWiki.jqueryMsg.getMessageFunction( options );
         *       $( 'p#headline' ).html( gM( 'hello-user', username ) );
         *
         * Like the old gM() function this returns only strings, so it destroys any bindings. If you want to preserve bindings use the
         * the current selector. Bindings to passed-in jquery elements are preserved. Functions become click handlers for [$1 linktext] links.
         * e.g.
         *
-        *        $.fn.msg = mediaWiki.parser.getJqueryPlugin( options );
+        *        $.fn.msg = mediaWiki.jqueryMsg.getPlugin( options );
         *        var userlink = $( '<a>' ).click( function () { alert( "hello!!" ) } );
         *        $( 'p#headline' ).msg( 'hello-user', userlink );
         *