From 3993a2d72f9b5085e43148d824cf4f8403fd5e54 Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Wed, 22 Jun 2011 21:54:18 +0000 Subject: [PATCH] Fix tablesorting bug that caused weird interferences between two tables; Make regex more strict to avoid mismatches. All QUnit tests pass now --- resources/jquery/jquery.tablesorter.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index 4dc6cfbdc7..7d5229b8c8 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -378,19 +378,11 @@ mergeSortHelper(array, begin, beginRight, end, sortList); } - var lastSort = ''; - function multisort( table, sortList, cache ) { //var sortTime = new Date(); var i = sortList.length; - if ( i == 1 && sortList[0][0] === lastSort) { - // Special case a simple reverse - cache.normalized.reverse(); - } else { - mergeSort(cache.normalized, 0, cache.normalized.length, sortList); - } - lastSort = ( sortList.length == 1 ) ? sortList[0][0] : ''; + mergeSort(cache.normalized, 0, cache.normalized.length, sortList); //benchmark( "Sorting in dir " + order + " time:", sortTime ); @@ -453,7 +445,7 @@ //Build RegEx //Any date formated with . , ' - or / - ts.dateRegex[0] = new RegExp(/^\s*\d{1,2}[\,\.\-\/'\s]*\d{1,2}[\,\.\-\/'\s]*\d{2,4}\s*?/i); + ts.dateRegex[0] = new RegExp(/^\s*\d{1,2}[\,\.\-\/'\s]{1,2}\d{1,2}[\,\.\-\/'\s]{1,2}\d{2,4}\s*?/i); //Written Month name, dmy ts.dateRegex[1] = new RegExp('^\\s*\\d{1,2}[\\,\\.\\-\\/\'\\s]*(' + r + ')' + '[\\,\\.\\-\\/\'\\s]*\\d{2,4}\\s*$', 'i'); -- 2.20.1