Merge "build: Enable jscs jsDoc rule 'requireReturnTypes' and make pass"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.util.js
index 6723e5f..2b4fa75 100644 (file)
@@ -33,7 +33,7 @@
                                ];
 
                                for ( i = 0, l = selectors.length; i < l; i++ ) {
-                                       $node = $( selectors[i] );
+                                       $node = $( selectors[ i ] );
                                        if ( $node.length ) {
                                                return $node.first();
                                        }
                                .replace( /%24/g, '$' )
                                .replace( /%21/g, '!' )
                                .replace( /%2A/g, '*' )
+                               .replace( /%27/g, '\'' )
                                .replace( /%28/g, '(' )
                                .replace( /%29/g, ')' )
                                .replace( /%2C/g, ',' )
                                .replace( /%2F/g, '/' )
+                               .replace( /%7E/g, '~' )
                                .replace( /%3A/g, ':' );
                },
 
                 *
                 * @since 1.18
                 * @param str string Name of script (eg. 'api'), defaults to 'index'
-                * @return string Address to script (eg. '/w/api.php' )
+                * @return {string} Address to script (eg. '/w/api.php' )
                 */
                wikiScript: function ( str ) {
                        str = str || 'index';
                                url = location.href;
                        }
                        // Get last match, stop at hash
-                       var     re = new RegExp( '^[^#]*[&?]' + $.escapeRE( param ) + '=([^&#]*)' ),
+                       var     re = new RegExp( '^[^#]*[&?]' + mw.RegExp.escape( param ) + '=([^&#]*)' ),
                                m = re.exec( url );
                        if ( m ) {
                                // Beware that decodeURIComponent is not required to understand '+'
                                // by spec, as encodeURIComponent does not produce it.
-                               return decodeURIComponent( m[1].replace( /\+/g, '%20' ) );
+                               return decodeURIComponent( m[ 1 ].replace( /\+/g, '%20' ) );
                        }
                        return null;
                },
                                        // Error: Invalid nextnode
                                        nextnode = undefined;
                                }
-                               if ( nextnode && ( nextnode.length !== 1 || nextnode[0].parentNode !== $ul[0] ) ) {
+                               if ( nextnode && ( nextnode.length !== 1 || nextnode[ 0 ].parentNode !== $ul[ 0 ] ) ) {
                                        // Error: nextnode must resolve to a single node
                                        // Error: nextnode must have the associated <ul> as its parent
                                        nextnode = undefined;
                        // to get a localized access key label (bug 67946).
                        $link.updateTooltipAccessKeys();
 
-                       return $item[0];
+                       return $item[ 0 ];
                },
 
                /**