Merge "Use native ES5 Array prototype methods instead of jQuery"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 22 Jan 2018 19:37:15 +0000 (19:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 22 Jan 2018 19:37:15 +0000 (19:37 +0000)
1  2 
resources/src/jquery/jquery.tablesorter.js

                                if ( rowIndex !== lastRowIndex ) {
                                        lastRowIndex = rowIndex;
                                        cellIndex = $( rows[ rowIndex ] ).data( 'columnToCell' )[ column ];
 -                                      nodeValue = $.trim( getElementSortKey( rows[ rowIndex ].cells[ cellIndex ] ) );
 +                                      nodeValue = getElementSortKey( rows[ rowIndex ].cells[ cellIndex ] ).trim();
                                }
                        } else {
                                nodeValue = '';
  
        /**
         * Converts sort objects [ { Integer: String }, ... ] to the internally used nested array
-        * structure [ [ Integer , Integer ], ... ]
+        * structure [ [ Integer, Integer ], ... ]
         *
         * @param {Array} sortObjects List of sort objects.
         * @return {Array} List of internal sort definitions.
         */
        function convertSortList( sortObjects ) {
                var sortList = [];
-               $.each( sortObjects, function ( i, sortObject ) {
+               sortObjects.forEach( function ( sortObject ) {
                        $.each( sortObject, function ( columnIndex, order ) {
                                var orderIndex = ( order === 'desc' ) ? 1 : 0;
                                sortList.push( [ parseInt( columnIndex, 10 ), orderIndex ] );
                },
                format: function ( s ) {
                        var tsc;
 -                      s = $.trim( s.toLowerCase() );
 +                      s = s.toLowerCase().trim();
                        if ( ts.collationRegex ) {
                                tsc = ts.collationTable;
                                s = s.replace( ts.collationRegex, function ( match ) {
                        return ts.rgx.url[ 0 ].test( s );
                },
                format: function ( s ) {
 -                      return $.trim( s.replace( ts.rgx.url[ 1 ], '' ) );
 +                      return s.replace( ts.rgx.url[ 1 ], '' ).trim();
                },
                type: 'text'
        } );
                },
                format: function ( s ) {
                        var match, y;
 -                      s = $.trim( s.toLowerCase() );
 +                      s = s.toLowerCase().trim();
  
                        if ( ( match = s.match( ts.dateRegex[ 0 ] ) ) !== null ) {
                                if ( mw.config.get( 'wgDefaultDateFormat' ) === 'mdy' || mw.config.get( 'wgPageContentLanguage' ) === 'en' ) {
        ts.addParser( {
                id: 'number',
                is: function ( s ) {
 -                      return $.tablesorter.numberRegex.test( $.trim( s ) );
 +                      return $.tablesorter.numberRegex.test( s.trim() );
                },
                format: function ( s ) {
                        return $.tablesorter.formatDigit( s );