r86088: Adding legacy support for .sortbottom & a test for it per CR
authorLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 30 Jun 2011 19:40:19 +0000 (19:40 +0000)
committerLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 30 Jun 2011 19:40:19 +0000 (19:40 +0000)
resources/jquery/jquery.tablesorter.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js

index 6abdfc0..14c6b0a 100644 (file)
 
                                                if ( firstTime ) {
                                                        firstTime = false;
+                                                       
+                                                       // Legacy fix of .sortbottoms
+                                                       // Wrap them inside inside a tfoot (because that's what they actually want to be) &
+                                                       // Move them up one level in the DOM
+                                                       var sortbottoms = $table.find('tr.sortbottom').wrap('<tfoot>');
+                                                       sortbottoms.parents('table').append(sortbottoms.parent());
+                                                       
                                                        explodeRowspans( $table );
                                                        // try to auto detect column type, and store in tables config
                                                        table.config.parsers = buildParserCache( table, $headers );
index 26e963d..de9098a 100644 (file)
@@ -352,4 +352,20 @@ tableTest(
        }
 );
 
+ascendingNameLegacy = ascendingName.slice(0);
+ascendingNameLegacy[4] = ascendingNameLegacy[5];
+ascendingNameLegacy.pop();
+
+tableTest(
+       'Legacy compat with .sortbottom',
+       header,
+       planets,
+       ascendingNameLegacy,
+       function( $table ) {
+               $table.find('tr:last').addClass('sortbottom');
+               $table.tablesorter();
+               $table.find('.headerSort:eq(0)').click();
+       }
+);
+
 })();