Table row construction

This tests the part of the HTML table algorithm that specifies the ordering of thead, tfoot, tbody, and plain tr elements in constructing a table.

The test

The following table is constructed, based on caption, thead, tbody, tfoot, and tr children which appear in the source in the row described.

Each thead, tbody, and tfoot contains a single tr element

thead, tbody, and tfoot are coloured by CSS, just to show what matches each selector - which seems to work according to spec.

F1First footer, first row of source
F2Second footer, second row of source
B1First tbody, third row of source
B2Second tbody, fourth row of source
H1First header, fifth row of source
H2Second header, sixth row of source
F3Third footer, seventh row of source
R1First direct tr child, eighth row of source
First caption, ninth child of the table Second caption, tenth child of the table
H2Third header, eleventh row of source
B3Third tbody, twelfth row of source
R2Second direct tr child, thirteenth row of source
B4Fourth tbody, fourteenth row of source
H4Fourth header, fifteenth row of source
F4Fourth footer, sixteenth row of source
R3Third direct tr child, seventeenth row of source

More information about the table generated

This bit is broken in IE / Edge. Pull requests accepted

The caption:

The Header:

The Footer:

First two and last two rows:

Number of tbodys:

Number of rows in table.rows:

Results

All tested browsers
render the first encountered thead at the top of the table and return its tr child as table.rows[0]
render the first tfoot encountered at the end of the table
render all other thead, tbody, tfoot, and direct tr children in the order they are encountered in the source.
The caption, tHead, and tFoot DOM attributes of the table match the first element of each type encountered in the source.
Yandex.browser 16.4 and Safari 9.1, on Mac OS X 10.10
Both caption elements are rendered, at the top of the table
Adds all tr children of thead elements to table.rows in the order they are encountered in the source, followed by all tr children of tbody elements or the table element itself, followed by all tr children of tfoot elements.
Microsoft Edge 25, Microsoft IE 11, on Windows 10
Both caption elements are rendered, at the top of the table
Puts the tr children of only the first thead child at the start of table.rows, and the tr children of only the first tfoot child at the end of it
Adds all tbody and direct tr children, and all tfoot and thead children other than the first of each enountered, to table.rows after the tr children of the first thead in the order they are encountered in the source.
Firefox 46
Only the first caption element encountered is rendered, at the top of the table
Puts the tr children of only the first thead child at the start of table.rows, and the tr children of only the first tfoot child at the end of it
Adds all tbody and direct tr children, and all tfoot and thead children other than the first of each enountered, to table.rows after the tr children of the first thead in the order they are encountered in the source.