tests added in follow up r102303.
This commit changes behavior on tables with multiple tbody's.
$table.prepend( $thead ); inserts as first child of the table element(s).
$table.prepend( $thead );
$table.children('tbody').before( $thead ); inserts it before the tbody element(s) in the table element(s).
$table.children('tbody').before( $thead );
Difference being that the latter will clone the $thead one or more time for each tbody element, of which there can me multiple.
$thead
tbody
The rationale for this revision is totally right, but I suggest using .find( 'tbody:first' ) instead of children( 'tbody' ) to avoid this side affect.
.find( 'tbody:first' )
children( 'tbody' )
See also
erm, that would be .find( ' > tbody:first' ), not .find( 'tbody:first' ). We don't want to mess up nested tables.
.find( ' > tbody:first' )