View Full Version : Switch Content Script doesn't work for tables in Firefox 1.03

06-01-2005, 09:10 PM
The attached file contains an example html page that should illustrate the problem.

In FF 1.03 the hide/redisplay functions create an ever expanding space. Also the table structure seems to get screwed up.

The last section of the example is the table structure without any script tags. This renders correctly in IE and FF.

There are no problems in IE.



06-01-2005, 10:03 PM
You cannot expand and contract a table row in FF like that. If you put a division or another table in a table cell and expand and contract that division or table, that will work in FF.

06-01-2005, 10:49 PM
You cannot expand and contract a table row in FF like that.Not in the way the script does it, no. However, you certainly can manipulate the display property to the desired effect.

The problem is that the script assigns the value, 'block', to the display property. Whilst this is fine for block-level elements, it is not for table rows and other similar elements which do not take this value (table rows, for example, have the value, 'table-row', in CSS 2).

The solution is not to assign any values other than 'none' to the display property. Instead, you assign an empty string. You can see this in the collapsible section (http://mwinter.webhop.info/dd/collapsible-section/collapsible-section.js) code I wrote recently.

Whilst the shifting that occurs in Firefox could be considered a bug on its part, the fact that 'block' is unconditionally assigned is a bug on the script's part.

If the script is updated, it fix this problem then one of two other alterations will be necessary.

If the script continues to initially hide content using a document-wide style sheet, then display property look-ups will need to be performed using the getComputedStyle method (or IE's equivalent, the currentStyle object).
If property look-ups continue to be performed using the inline style object, then content will need to be hidden using that same object like I do in collapsible section (http://mwinter.webhop.info/dd/collapsible-section/collapsible-section.js).