Add comments and fix whitespace for r90657, r86305
authorKrinkle <krinkle@users.mediawiki.org>
Wed, 24 Aug 2011 19:35:18 +0000 (19:35 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Wed, 24 Aug 2011 19:35:18 +0000 (19:35 +0000)
resources/jquery/jquery.tablesorter.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js

index 3470100..e769185 100644 (file)
@@ -8,8 +8,9 @@
  * http://www.opensource.org/licenses/mit-license.php
  * http://www.gnu.org/licenses/gpl.html
  *
- * @depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort,
+ * Depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort,
  * wgDefaultDateFormat, wgContentLanguage)
+ * Uses 'tableSorterCollation' in mw.config (if available)
  */
 /**
  *
                        realCellIndex = 0,
                        $tableHeaders = $( 'thead:eq(0) tr', table );
                if ( $tableHeaders.length > 1 ) {
-                       $tableHeaders.each(function() {
+                       $tableHeaders.each( function() {
                                if ( this.cells.length > maxSeen ) {
                                        maxSeen = this.cells.length;
                                        longest = this;
index ea3cc9b..fddf844 100644 (file)
@@ -286,15 +286,20 @@ tableTest(
        umlautWords,
        umlautWordsSorted,
        function( $table ) {
-               mw.config.set( 'tableSorterCollation', {'ä':'ae', 'ö' : 'oe', 'ß': 'ss', 'ü':'ue'});
+               mw.config.set( 'tableSorterCollation', {
+                       'ä': 'ae',
+                       'ö' : 'oe',
+                       'ß': 'ss',
+                       'ü':'ue'
+               } );
                $table.tablesorter();
                $table.find( '.headerSort:eq(0)' ).click();
                mw.config.set( 'tableSorterCollation', {} );
        }
 );
 
-var planetsRowspan  =[["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus];
-var planetsRowspanII  =[jupiter, mercury, saturn, ['Venus', '6371.0'], venus, ['Venus', '3390.0']];
+var planetsRowspan [["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus];
+var planetsRowspanII [jupiter, mercury, saturn, ['Venus', '6371.0'], venus, ['Venus', '3390.0']];
 
 tableTest(
        'Basic planet table: Same value for multiple rows via rowspan',
@@ -302,9 +307,13 @@ tableTest(
        planets,
        planetsRowspan,
        function( $table ) {
-               //Quick&Dirty mod
+               // Modify the table to have a multiuple-row-spanning cell:
+               // - Remove 2nd cell of 4th row, and, 2nd cell or 5th row.
                $table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove();
+               // - Set rowspan for 2nd cell of 3rd row to 3.
+               //   This covers the removed cell in the 4th and 5th row.
                $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' );
+
                $table.tablesorter();
                $table.find( '.headerSort:eq(0)' ).click();
        }
@@ -315,9 +324,13 @@ tableTest(
        planets,
        planetsRowspanII,
        function( $table ) {
-               //Quick&Dirty mod
+               // Modify the table to have a multiuple-row-spanning cell:
+               // - Remove 1st cell of 4th row, and, 1st cell or 5th row.
                $table.find( 'tr:eq(3) td:eq(0), tr:eq(4) td:eq(0)' ).remove();
+               // - Set rowspan for 1st cell of 3rd row to 3.
+               //   This covers the removed cell in the 4th and 5th row.
                $table.find( 'tr:eq(2) td:eq(0)' ).prop( 'rowspan', '3' );
+
                $table.tablesorter();
                $table.find( '.headerSort:eq(0)' ).click();
        }