Closed Bug 312469 Opened 19 years ago Closed 19 years ago

toggling display style to none on <tr> fails

Categories

(Core :: Layout: Tables, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 97506

People

(Reporter: patrick, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728

If you create a table row and then toggle its display style to none the content
of the row disappears as expected, but the row still takes up space on the page.
It should take up no space, however it acts the same as if the visibility style
was set to hidden.

The display style works fine for <div> and <table> tags.

To reproduce simply visit:
http://patrick.spacesurfer.com/moz_bug_14102005.html
and click on the "click here for broken" link several times.

Reproducible: Always
Maybe tables just have a default padding?
Component: General → Layout: Tables
Product: Firefox → Core
QA Contact: general → layout.tables
Version: unspecified → Trunk
Its not a padding issue, because the more you toggle the display style the more
space the table row is taking up. It looks like setting the display to none is
the problem, since the table row still takes up space. Then setting the display
to block or inline causes more space to be allocated for the table row which
presumably is correct behaviour.

Try the web page, its much better at demonstrating the problem than I am at
explaining it!
Toggling display style on a <tr> requires 
display: table-row;, not display: block;
( see http://www.w3.org/TR/CSS21/visuren.html#display-prop and
http://www.w3.org/TR/CSS21/tables.html#value-def-table-row )
or even much better, to use
visibility: collapse
for CSS 2.x compliant browsers.
"The 'visibility' property takes the value 'collapse' for row, row group,
column, and column group elements. This value causes the entire row or column to
be removed from the display"
http://www.w3.org/TR/CSS21/tables.html#dynamic-effects

One reliable cross-browser way is to toggle display value between "" (default
display value) and none.

"Its not a padding issue, because the more you toggle the display style the more
space the table row is taking up." I see this too with Firefox 1.4.1 and
Seamonkey 1.9a1 20051012 nightly builds but this (not sure) may be an entirely
different bug.

I'm enclined to resolve this bug as INVALID.
(In reply to comment #4)

> "Its not a padding issue, because the more you toggle the display style the 
> more space the table row is taking up." I see this too with Firefox 1.4.1 and
> Seamonkey 1.9a1 20051012 nightly builds but this (not sure) may be an entirely
> different bug.

Watching the testcase in DOM Inspector, the table starts with a height of 0,
expands to 30, shrinks to 5, expands to 33, shrinks to 8 ...

First expansion is 30px, following expansions only 28 px, all shrinks are 25px.
Keywords: testcase
Well using "" or "table-row" do seem to work. "table-row" even works on the <div>.

When setting the display to "block" Gecko's behaviour could definately improve,
possibly throw an error or ideally behave as if the display were "table-row",
since on IE "table-row" doesn't work and "block" does.

Either way I dont think this is a big deal, it is just that this was causing
some very weird behaviour on one of our apps when IE worked fine.

Feel free to mark as INVALID or WONTFIX

Patrick
Keywords: testcase
Since the last three dozen or so have been duplicates of bug 97506, I think
maybe that's a better disposition than invalid or wontfix.

*** This bug has been marked as a duplicate of 97506 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: