Follow me as I struggle with rogue technology, insane programmers, and impossible math questions in a battle to the death.

Monday, September 29, 2008

Bug in colgroup tag in Firefox

I was working on a webpage where I needed to have an HTML table with an invisible column that I could make visible at will. To do this, I created a colgroup for the table that contained col tags, and I set the style of the col to display:none, which could be changed to display:visible with javascript.

When I tested the code, I found it worked correctly in IE7, but it didn't work in Firefox 3 at all!

Here is some code showing the problem:

<html>
<head><title>Bug in the COL tag</title></head>
<body>
<table border="1">
<colgroup span="3">
<col style="background:red"><col style="display:none"><col style="background:blue">
</colgroup>
<tbody>
<tr><td>hello</td><td>hi</td><td>goodbye</td></tr>

<tr><td>hello</td><td>hi</td><td>goodbye</td></tr>
<tr><td>hello</td><td>hi</td><td>goodbye</td></tr>
<tr><td>hello</td><td>hi</td><td>goodbye</td></tr>
<tr><td>hello</td><td>hi</td><td>goodbye</td></tr>

</tbody>
</table>
</body>
<html>

I submitted the bug to Mozilla, so hopefully someone takes a look at it.

Labels: , ,

1 Comments:

Blogger Unknown said...

That's actually pretty neat - it's obvious that Firefox is actually listening to display:none, because the background colors shift one column left.

By the way, you don't want display:visible, it'd be display:table-column.

3:22 PM

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home