Page MenuHomePhabricator

jquery.tablesorter.js: thead is before caption
Closed, ResolvedPublic

Description

The caption element must be the first element of a table element: http://www.w3.org/TR/html5/tabular-data.html#the-caption-element

{| class="wikitable sortable"

+ CAPTION
-

! THEAD

-
A
-
B
- class="sortbottom"
TFOOT
}

is converted to

<table class="wikitable sortable jquery-tablesorter">
<thead>
<tr>
<th class="headerSort" title="Aufsteigend sortieren">THEAD</th>
</tr>
</thead>
<caption>CAPTION</caption>
<tbody>
<tr>
<td>A</td>
</tr>
<tr>
<td>B</td>
</tr>
<tr class="sortbottom">
<td>TFOOT</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>

expected result:

<table class="wikitable sortable jquery-tablesorter">
<caption>CAPTION</caption>
<thead>
<tr>
<th class="headerSort" title="Aufsteigend sortieren">THEAD</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
</tr>
<tr>
<td>B</td>
</tr>
</tbody>
<tfoot>
<tr class="sortbottom">
<td>TFOOT</td>
</tr>
</tfoot>
</table>


Version: 1.18.x
Severity: normal
URL: https://forum.jquery.com/topic/in-table-with-class-sortable-thead-is-before-caption

Details

Reference
bz32047

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:00 AM
bzimport set Reference to bz32047.
bzimport added a subscriber: Unknown Object (MLST).

Looks like a bug in JQuery tablesorter , specially the emulateTHeadAndFoot() method.

(In reply to comment #1)

Looks like a bug in JQuery tablesorter , specially the emulateTHeadAndFoot()
method.

Yes. It adds the emulated <thead> as the first element, but it should add it after any <caption> instead.

(In reply to comment #2)

(In reply to comment #1)

Looks like a bug in JQuery tablesorter , specially the emulateTHeadAndFoot()
method.

Yes. It adds the emulated <thead> as the first element, but it should add it
after any <caption> instead.

Is there an upstream bug report for this?

(In reply to comment #0)

The caption element must be the first element of a table element

Do you have a patch that we could use?

Patch for jquery.tablesorter.js

Attached:

sumanah wrote:

Thanks for the patch! I'll ask someone to review it as soon as possible. Adding the "patch" and "need-review" keywords to signal that this bug now includes a patch that needs review.

r102303 - QUnit javascript tests.

r102301 should included in 1.18 like Bug 32049.