Merge "JavaScriptMinifier: Fix bad state after ternary in object literal"
[lhc/web/wiklou.git] / resources / src / mediawiki.jqueryMsg / mediawiki.jqueryMsg.js
index d81df65..b7fd6fd 100644 (file)
@@ -1,3 +1,4 @@
+/* eslint-disable no-restricted-properties */
 /*!
 * Experimental advanced wikitext parser-emitter.
 * See: https://www.mediawiki.org/wiki/Extension:UploadWizard/MessageParser for docs
@@ -20,7 +21,7 @@
                        },
                        // Whitelist for allowed HTML elements in wikitext.
                        // Self-closing tags are not currently supported.
-                       // Can be populated via setPrivateData().
+                       // Can be populated via setParserDefaults().
                        allowedHtmlElements: [],
                        // Key tag name, value allowed attributes for that tag.
                        // See Sanitizer::setupAttributeWhitelist
         * e.g.
         *
         *        $.fn.msg = mediaWiki.jqueryMsg.getPlugin( options );
-        *        var userlink = $( '<a>' ).click( function () { alert( "hello!!" ) } );
-        *        $( 'p#headline' ).msg( 'hello-user', userlink );
+        *        var $userlink = $( '<a>' ).click( function () { alert( "hello!!" ) } );
+        *        $( 'p#headline' ).msg( 'hello-user', $userlink );
         *
         * N.B. replacements are variadic arguments or an array in second parameter. In other words:
         *    somefunction( a, b, c, d )
                getAst: function ( key ) {
                        var wikiText;
 
-                       if ( !this.astCache.hasOwnProperty( key ) ) {
+                       if ( !Object.prototype.hasOwnProperty.call( this.astCache, key ) ) {
                                wikiText = this.settings.messages.get( key );
                                if ( typeof wikiText !== 'string' ) {
                                        wikiText = '⧼' + key + '⧽';
                        return oldParser.apply( this );
                }
 
-               if ( !this.map.hasOwnProperty( this.format ) ) {
+               if ( !Object.prototype.hasOwnProperty.call( this.map, this.format ) ) {
                        this.map[ this.format ] = mw.jqueryMsg.getMessageFunction( {
                                messages: this.map,
                                // For format 'escaped', escaping part is handled by mediawiki.js
         * @return {jQuery}
         */
        mw.Message.prototype.parseDom = ( function () {
-               var reusableParent = $( '<div>' );
+               var $wrapper = $( '<div>' );
                return function () {
-                       return reusableParent.msg( this.key, this.parameters ).contents().detach();
+                       return $wrapper.msg( this.key, this.parameters ).contents().detach();
                };
        }() );