views:

248

answers:

4

Please help me with this validation error. I can't understand what it means or what's not standards complaint with my HTML.

I'll repost it here since hopefully I'll fix it and that link will no longer work:

Table column 2 established by element td has no cells beginning in it.

…="tooltip_table"><tr><td colspan="2">20 yd range</td></tr><tr><td colspan="2"
                                     ↑
+3  A: 

When you say colspan="2", the column is supposed to stretch across two columns. My guess would be that there is no second column defined anywhere else in the able, thus making colspan="2" impossible (and unnecessary).

I can't find anything in the spec explicitly saying it's illegal. Maybe the table calculating algorithm quoted in that spec is different from 4.01, but it's way too late in my time zone to try and get around that :)

However, I find the error message makes too perfect sense to be an outright bug.

Table column 2 established by element td has no cells beginning in it.

By using colspan="2", you imply the existence of a second column, which doesn't exist in that case. Common sense tells me it is correct to nag about.

Maybe somebody can shed some light on this... Or it is, indeed, a bug.

Pekka
But that's not illegal as far as I know.. Do you have any source that says it is?
Andreas Bonini
The table is not the only one like that in the document. However, only that table's markup errs.
glebm
@Andreas no, I can't find anything. See my edited answer.
Pekka
@Glex I didn't see that, if that is true then it must be a bug.
Pekka
+1  A: 

Looks like an issue with the HTML5 validator. That error does not come up if you validate is with HTML 4.01 Transitional, and the table html has not been changed that much in html5.

http://validator.w3.org/check?uri=http://www.wowpanda.net/s9712&amp;charset=(detect+automatically)&amp;doctype=HTML+4.01+Transitional&amp;ss=1&amp;outline=1&amp;group=0&amp;verbose=1&amp;user-agent=W3C_Validator/1.654

Reporting it is probably a good idea

glebm
HTML 5 and 4.01 are entirely different beasts, and the fact that the one applies a different rule set than the other is, even though it might, not necessarily a "bug." Without more evidence, I think there is no need for the b-word :)
Pekka
Point taken. However, before posting the answer I read this: http://www.w3.org/TR/html5/tabular-data.htmlAnd there is no evidence whatsoever that the <table><tr><td> structure changed that much.Let's call it an Issue, because we are not sure it is a bug :)
glebm
@Glex I just came back from reading the same document :) There's indeed nothing in there but to me, the error message makes too much sense to be a bug. Well, we'll see, if a report gets filed I would be interested to know what comes out of it.
Pekka
Henri Sivonen's validator says the same, so it would be a bug in two independent validators? (They *are* independent, aren't they?) http://html5.validator.nu/?doc=http%3A%2F%2Fwww.wowpanda.net%2Fs9712
Marcel Korpel
@Marcel - I think they are one and the same.
Alohci
The legacy validator simply doesn't check for this class of error at all. This is an improvement over legacy--not a bug in the HTML5 validator.
hsivonen
+3  A: 

HTML 5 Draft: Section 4.9.12.1 Forming a table

(http://dev.w3.org/html5/spec/tabular-data.html#forming-a-table)

Step 20: If there exists a row or column in the table [the table] containing only slots that do not have a cell anchored to them, then this is a table model error.

Alohci
I see. This seems to be the answer.
glebm
A: 

I had the same error on a dynamically created table. Depending on the input, some rows were displayed or not. Like this:

Causes no error:

<table>
<tr>
<td> cell 1 in row 1 </td>
<td> cell 2 in row 1 </td>
</tr>
<tr>
<td colspan=2> one cell in row 2 </td>
</tr>
</table>

Causes no error:

<table>
<tr>
<td> cell 1 in row 1 </td>
<td> cell 2 in row 1 </td>
</tr>
</table>

Causes an error:

<table>
<tr>
<td colspan=2> one cell in row 2 </td>
</tr>
</table>

Once I programmed the page to delete the colspan from the last example when the first row was not displayed, the error disappeared. Something like this:

<?php if (first row with two cells is displayed) echo 'colspan=2'; ?>

I find this logical. colspan=2 with only single cells is like telling someone visiting me to turn right on a street that does not have any junctions, believing that they will continue straight on. They won't. Instead they will get hung up searching for something that is not there. Maybe not a completely accurate analogy, but you can imagine a dumb browser creating display errors while looking for stuff that you tell it is there, but is not. Browsers shouldn't be expected to "think" that maybe you meant your code differently from how you wrote it.

Manfred Kooistra