Omissions of thead / colgroup / tbody / tr / td elements aren't handled well
Created by: abotalov
The HTML5, HTML5.1, WHATWG specs have some rules for handling thead / tbody / tr elements.
Due to those rules the following markup:
<table>
<colgroup><col><col><col>
<thead>
<tr> <th>Function <th>Control Unit <th>Central Station
<tbody>
<tr> <td>Headlights <td>✔ <td>✔
<tr> <td>Interior Lights <td>✔ <td>✔
<tr> <td>Electric locomotive operating sounds <td>✔ <td>✔
<tr> <td>Engineer's cab lighting <td> <td>✔
<tr> <td>Station Announcements - Swiss <td> <td>✔
</table>
should be mostly DOM equivalent (if not considering whitespace) to:
<table>
<colgroup><col><col><col></colgroup>
<thead>
<tr>
<th>Function</th>
<th>Control Unit</th>
<th>Central Station</th>
</tr>
</thead>
<tbody>
<tr>
<td>Headlights</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td>Interior Lights</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td>Electric locomotive operating sounds</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td>Engineer's cab lighting</td>
<td></td>
<td>✔</td>
</tr>
<tr>
<td>Station Announcements - Swiss</td>
<td></td>
<td>✔</td>
</tr>
</tbody>
</table>
But currently it's equivalent to:
<!DOCTYPE HTML>
<table>
<colgroup><col /><col /><col />
<thead>
<tr> <th>Function </th><th>Control Unit </th><th>Central Station
<tbody>
<tr> <td>Headlights </td><td>✔ </td><td>✔
<tr> <td>Interior Lights </td><td>✔ </td><td>✔
<tr> <td>Electric locomotive operating sounds </td><td>✔ </td><td>✔
<tr> <td>Engineer's cab lighting </td><td> </td><td>✔
<tr> <td>Station Announcements - Swiss </td><td> </td><td>✔
</td></tr></td></tr></td></tr></td></tr></td></tr></tbody></th></tr></thead></colgroup></table>
(The example is from HTML 5.1 spec. I only omitted caption tag but probably it should also be supported - it's also in WHATWG spec which is "living standard").