$.tablesorter: remove and inline getTextFromRowAndCellIndex()
authorMatmaRex <matma.rex@gmail.com>
Fri, 4 Jan 2013 17:27:36 +0000 (18:27 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 15 Mar 2013 15:56:33 +0000 (15:56 +0000)
It introduced unnecessary indirection and was only called once.

Change-Id: I519cc1f04a581d41aa23229182c55466ed7757c8

resources/jquery/jquery.tablesorter.js

index 8320304..e252ba5 100644 (file)
                }
        }
 
-       function getTextFromRowAndCellIndex( rows, rowIndex, cellIndex ) {
-               if ( rows[rowIndex] && rows[rowIndex].cells[cellIndex] ) {
-                       return $.trim( getElementSortKey( rows[rowIndex].cells[cellIndex] ) );
-               } else {
-                       return '';
-               }
-       }
-
        function detectParserForColumn( table, rows, cellIndex ) {
                var l = parsers.length,
                        nodeValue,
                        concurrent = 0,
                        needed = ( rows.length > 4 ) ? 5 : rows.length;
 
-               while( i < l ) {
-                       nodeValue = getTextFromRowAndCellIndex( rows, rowIndex, cellIndex );
+               while ( i < l ) {
+                       if ( rows[rowIndex] && rows[rowIndex].cells[cellIndex] ) {
+                               nodeValue = $.trim( getElementSortKey( rows[rowIndex].cells[cellIndex] ) );
+                       } else {
+                               nodeValue = '';
+                       }
+
                        if ( nodeValue !== '') {
                                if ( parsers[i].is( nodeValue, table ) ) {
                                        concurrent++;