COL and COLGROUP get captured by CAPTION in Safari

I was finding myself unable to tell Safari to set the background color of COL and COLGROUP. The problem turned out to be the CAPTION element, which the HTML-spesification tells us must follow immediately after the TABLE start tag, as in this example:

Table with caption following the table start tag
Placeholder text on red(!) background. Placeholder. Column width to be just 10em(!) if this column
is not dark green,
the test has failed

When Safari displays the above table, not only doesn't the col/colgroup get colored, but the whole table breaks down. Since the background colors have been set only by styling the col tags, and because Safari gets so confused by the caption, Safari shows no background colors in this table - exept in the caption itself. And this also cause the cells to grow in width, the more text you fill into them ... (Without the placeholder texts, the entire table would simply collapse - like the screenshot from Safari to the right here shows.) Simply put: To use the CAPTION element according to the specs hinders Safari from using col and colgroup as selectors.


The workaround I know about, is to place the CAPTION below the col and colgroup tags, like this:

Table with misplaced caption
if this column
is not dark green,
the test has failed

However, this will cause the doc to not validate.