Hello out there!
Eine Tabelle besteht formal aus folgenden Teilen:
<table>
+- <thead>*
+- <tr>**
+- <th>**
+- <td>**
+- <tbody>*
+- <tr>**
+- <th>**
+- <td>**
+- <tfoot>*
+- <tr>**
+- <th>**
+- <td>*** optionale Elemente, sind im DOM tückischerweise z.T. automatisch vorhanden obwohl im Quelltext nicht sichtbar
** dürfen mehrfach vorkommen.
Hast du einen Stern vergessen oder meintest du es tatsächlich falsch? Richtig ist:
+- <tbody>**
Es dürfen mehrere 'tbody'-Elemente vorkommen, aber es muss mindestens eins sein; 'tbody' ist also nicht optional. In der DTD liest sich das so:
<!ELEMENT TABLE - -
(CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)> [HTML401 §11.2.1]
Optional hingegen ist sind beim 'tbody'-Elementtyp Start- und End-Tag:
<!ELEMENT TBODY O O (TR)+ -- table body --> [HTML401 §11.2.3]
Das heißt, auch wenn kein '<tbody>'-_Tag_ notiert wird, ist ein 'tbody'-_Element_ dennoch vorhanden. (An der Stelle ist die Unterscheidung von „Tag“ und „Element“ essentiell. [Meiert])
<table>
<tr>
<td>foo</td>
</tr>
</table>
und
<table>
<tbody>
<tr>
<td>foo</td>
</tr>
</tbody>
</table>
sind völlig äquivalent und erzeugen denselben Elementbaum:
table
└ tbody
└ tr
└ td
In XHTML 1.0 hingegen gibt es keine optionalen Tags. Dafür ist aber das 'tbody'-Element optional; 'tr' darf auch als Kind von 'table' vorkommen:
<!ELEMENT table
(caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> [XHTML1 §A]
Erstgenannter Quelltext ergibt bei Verarbeitung als 'application/xhtml+xml'(!) diesen Elementbaum:
table
└ tr
└ td
Aber nochmal zurück zu deinem geposteten Elementbaum: Die Reihenfolge war auch falsch; erst kommt 'tfoot', dann 'tbody'.
See ya up the road,
Gunnar
„Und [dieses Forum] soll […] auch ein Fachforum bleiben und kein Psychologieforum werden.“ (Kirsten Evers)