jquery.textSelection: Remove incorrect browser hack for old Opera
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.jqueryMsg.js
index 6d3b4f0..ea91afe 100644 (file)
                        // recursive functions seem not to work in all browsers then. (Tested IE6-7, Opera, Safari, FF)
                        // This may be because, to save code, memoization was removed
 
+                       /* eslint-disable no-useless-escape */
                        regularLiteral = makeRegexParser( /^[^{}\[\]$<\\]/ );
                        regularLiteralWithoutBar = makeRegexParser( /^[^{}\[\]$\\|]/ );
                        regularLiteralWithoutSpace = makeRegexParser( /^[^{}\[\]$\s]/ );
                        regularLiteralWithSquareBrackets = makeRegexParser( /^[^{}$\\]/ );
+                       /* eslint-enable no-useless-escape */
 
                        backslash = makeStringParser( '\\' );
                        doubleQuote = makeStringParser( '"' );
 
                                startTagName = startTagName.toLowerCase();
                                endTagName = endTagName.toLowerCase();
-                               if ( startTagName !== endTagName || $.inArray( startTagName, settings.allowedHtmlElements ) === -1 ) {
+                               if ( startTagName !== endTagName || settings.allowedHtmlElements.indexOf( startTagName ) === -1 ) {
                                        return false;
                                }
 
                                for ( i = 0, len = attributes.length; i < len; i += 2 ) {
                                        attributeName = attributes[ i ];
-                                       if ( $.inArray( attributeName, settings.allowedHtmlCommonAttributes ) === -1 &&
-                                               $.inArray( attributeName, settings.allowedHtmlAttributesByElement[ startTagName ] || [] ) === -1 ) {
+                                       if ( settings.allowedHtmlCommonAttributes.indexOf( attributeName ) === -1 &&
+                                               ( settings.allowedHtmlAttributesByElement[ startTagName ] || [] ).indexOf( attributeName ) === -1 ) {
                                                return false;
                                        }
                                }
                        templateName = transform(
                                // see $wgLegalTitleChars
                                // not allowing : due to the need to catch "PLURAL:$1"
-                               makeRegexParser( /^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/ ),
+                               makeRegexParser( /^[ !"$&'()*,./0-9;=?@A-Z^_`a-z~\x80-\xFF+-]+/ ),
                                function ( result ) { return result.toString(); }
                        );
                        function templateParam() {
                                        $el.attr( {
                                                role: 'button',
                                                tabindex: 0
-                                       } )
-                                       .on( 'click keypress', function ( e ) {
+                                       } ).on( 'click keypress', function ( e ) {
                                                if (
                                                        e.type === 'click' ||
                                                        e.type === 'keypress' && e.which === 13
                 * @return {string} Localized namespace name
                 */
                ns: function ( nodes ) {
-                       var ns = $.trim( textify( nodes[ 0 ] ) );
+                       var ns = textify( nodes[ 0 ] ).trim();
                        if ( !/^\d+$/.test( ns ) ) {
                                ns = mw.config.get( 'wgNamespaceIds' )[ ns.replace( / /g, '_' ).toLowerCase() ];
                        }
        // Replace the default message parser with jqueryMsg
        oldParser = mw.Message.prototype.parser;
        mw.Message.prototype.parser = function () {
-               if ( this.format === 'plain' || !/\{\{|[\[<>&]/.test( this.map.get( this.key ) ) ) {
+               if ( this.format === 'plain' || !/\{\{|[<>[&]/.test( this.map.get( this.key ) ) ) {
                        // Fall back to mw.msg's simple parser
                        return oldParser.apply( this );
                }