r102301 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102300‎ | r102301 | r102302 >
Date:17:33, 7 November 2011
Author:mah
Status:resolved (Comments)
Tags:
Comment:
Fix Bug #32047: in table with class="sortable", thead is before
caption

Apply fomafix's patch for jquery.tablesorter.js (also reported upstream:
https://forum.jquery.com/topic/in-table-with-class-sortable-thead-is-before-caption
(currently in moderation)
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.tablesorter.js (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -99,6 +99,7 @@
100100 * Edward Z. Yang
101101 * Erwin Dokter
102102 * FunPika
 103+* fomafix
103104 * Gero Scholz
104105 * Grunny
105106 * Harry Burt
Index: trunk/phase3/resources/jquery/jquery.tablesorter.js
@@ -241,7 +241,7 @@
242242 }
243243 $thead.append( this );
244244 } );
245 - $table.prepend( $thead );
 245+ $table.children('tbody').before( $thead );
246246 }
247247 if( !$table.get(0).tFoot ) {
248248 var $tfoot = $( '<tfoot>' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r102303tests for bug 32047 / r102301...hashar17:48, 7 November 2011
r102710on tablesort, verify <caption> is the first child in the table...hashar22:54, 10 November 2011
r103029REL1_18 MFT r99236, r102301, r102303, r102498, r102710, r102751, r102951, r10...reedy20:58, 14 November 2011
r108066re r102301 — apply Krinkle's suggested fix.mah19:09, 4 January 2012

Comments

#Comment by Hashar (talk | contribs)   17:49, 7 November 2011

tests added in follow up r102303.

#Comment by Krinkle (talk | contribs)   10:31, 2 January 2012

This commit changes behavior on tables with multiple tbody's.

$table.prepend( $thead ); inserts as first child of the table element(s).

$table.children('tbody').before( $thead ); inserts it before the tbody element(s) in the table element(s).

Difference being that the latter will clone the $thead one or more time for each tbody element, of which there can me multiple.

The rationale for this revision is totally right, but I suggest using .find( 'tbody:first' ) instead of children( 'tbody' ) to avoid this side affect.

See also

#Comment by Krinkle (talk | contribs)   10:33, 2 January 2012

erm, that would be .find( ' > tbody:first' ), not .find( 'tbody:first' ). We don't want to mess up nested tables.

Status & tagging log