<thead>
<tr>...</tr>
</thead>
<tfoot>
<tr>...</tr>
</tfoot>
//If there is no table body (no <tbody>, nor is it implicit because of a normal <tr>), then give up. Otherwise, we get errors later.
if (table.getElementsByTagName('tbody').length == 0){
//console.log ("disembodied table.");
return;
}
If the table contains an explicit
<tbody></tbody>section, then sorttable handles it fine.But in the usual case, where the
<tbody>tags are omitted (because they are considered implicit) AND the table has no main rows (i.e. there are no<tr>that come after<thead>and before<tfoot>), then sorttable complains and generates JS errors.The fix is to add the following, in makeSortable, just after the test for table.tHead == null: