From: MatmaRex Date: Fri, 4 Jan 2013 17:27:36 +0000 (+0100) Subject: $.tablesorter: remove and inline getTextFromRowAndCellIndex() X-Git-Tag: 1.31.0-rc.0~20333 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=b9e9407ffb896192cd4ed115048bb3f9f110bd2b;p=lhc%2Fweb%2Fwiklou.git $.tablesorter: remove and inline getTextFromRowAndCellIndex() It introduced unnecessary indirection and was only called once. Change-Id: I519cc1f04a581d41aa23229182c55466ed7757c8 --- diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index 8320304ff1..e252ba549c 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -113,14 +113,6 @@ } } - 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, @@ -130,8 +122,13 @@ 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++;