Re: HTML5 Validator doesn't appear to understand colspan

"Jukka K. Korpela" <jkorpela@cs.tut.fi>, 2011-05-23 23:14 +0300:

> 23.5.2011 22:50, Michael[tm] Smith wrote:
> 
> >Can you please either post a URL for the page that contains that colspan,
> >or a reduced document that causes the same error to be emitted?
> 
> Well, the description was somewhat obscure, but it seems that the following
> minimal document exhibits the problem:
> 
> <!doctype html><title></title>
> <table><tr><td colspan=2></table>
> 
> >And that error message is indicating that your colspan attribute is
> >establishing a column that ends up not having any cells in it
> 
> The way I see it, the <td colspan=2> element should establish two columns,
> with one cell in each column, though the cell is shared

The HTML5 spec has a detailed definition of the table model it uses:

  http://dev.w3.org/html5/spec/tabular-data.html#table-model

As well as defining a "forming a table" algorithm for conforming UAs:

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

And that algorithm does in fact cause two columns to be established by the
colspan in the markup example above. But it doesn't cause one cell to be
created in each column -- nor, as far as I know, have the concept of a
shared cell like what you describe.

> But it seems that HTML5 wishes to disallow such usage where the second
> column has no other cells. The usage is probably harmless but redundant (you
> could just omit the colspan attribute), and treating it as an error may help
> to detect real problems where the colspan attribute was not meant to be
> redundant.

Yeah, that's the intent of having this particular conformance constraint in
the spec, and the intent of having the validator check it; that is, in this
case, to make users aware of colspans which may not be doing what they
think they're supposed to be doing. Of course, if a user is intentionally
putting such a colspan, that user can safely ignore the message about this
that the validator emits.

  --Mike
 

-- 
Michael[tm] Smith
http://people.w3.org/mike

Received on Wednesday, 25 May 2011 09:27:56 UTC