Yes, yes. Functionally, they are different. But heck if I didn’t know about the wacky thresholds until Jens Oliver Meiert tooted a pair of quick polls.
According to the HTML Standard:
- If the current cell has a
colspan
attribute, then parse that attribute’s value, and let colspan be the result.
If parsing that value failed, or returned zero, or if the attribute is absent, then let colspan be 1, instead.
If colspan is greater than 1000, let it be 1000 instead.- If the current cell has a
rowspan
attribute, then parse that attribute’s value, and let rowspan be the result.
If parsing that value failed or if the attribute is absent, then let rowspan be 1, instead.
If rowspan is greater than 65534, let it be 65534 instead.
I saw the answers in advance and know I’d have flubbed rowspan
. Apparently, 1000
table columns are plenty of columns to span at once, while 65534
is the magic number for clamping how many rows we can span at a time. Why is the sweet spot for rowspan
6,4543 spans greater than colspan
? There are usually good reasons for these things.
What that reason is, darned if I know, but now I have a little nugget for cocktail chatter in my back pocket.
65535 is the biggest value you can store in an unsigned 16-bit integer, so presumably 65534 was chosen to just fit within that limit for performance reasons.
Makes sense! But still, why draw the limit for one attribute at
1000
and the other at65534
? That’s what’s funny to me.I doubt there’s a specific reason for the number 1000 other than just being a nice-looking number, but I think there’s semantical sense in putting a harder limit on columns than on rows.
A single row in a table is expected to contain information about a single item. A single record. There can be many fields in the record, but it’s expected that there wouldn’t be “too many” for the table to be useful.
On the other hand, the number of different items isn’t supposed to have any limit, semantically-speaking, so the limit is just decided from a technical perspective.
Boris Zbarsky, in a Bugzilla thread said back in 2011:
“Webkit and Gecko both cap rowspan at 8190. colspan is capped at 1000 in all browsers I know of.
“The 8190 cap is caused by the fact that the data structure used to store the rowspan only has 13 bits to store it in. Not sure why the cap is 8190 and not 8191, though.
…
“That said, since colspan is capped to 1000 but also has 13 bits, we could steal 3 bits from colspan for rowspan. That would allow us to have rowspans up to 65535 or so, assuming we want that. …���