Closed Bug 214757 Opened 22 years ago Closed 22 years ago

Using style display:block->display:none -> display:block on <TR> elements causes incorrect table layout

Categories

(Core :: Layout, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 97506

People

(Reporter: cpicton, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030630 Epiphany/0.8.0 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030630 Epiphany/0.8.0 In the code inserted at the end, 3 table rows are displayed. Each button shows or hides the table row. If all 3 are hidden, when one is shown again, the top table boder grows to large. Repeating this process causes the top border to continually grow with each iteration of hide all -> show one. -------------- <HTML> <HEAD> <SCRIPT> function showhide(id) { element = document.getElementById(id); if (element && element.style) { if (!element.style.display || element.style.display == 'none') element.style.display = 'block'; else element.style.display = 'none'; } else { alert('Element ' + id + ' not found'); } } </SCRIPT> </HEAD> <BODY> <TABLE border=1> <TR id=row1 style='display: block'><td>Cell 1</td></tr> <tr id=row2 style='display: block'><td>Cell 2</td></tr> <tr id=row3 style='display: block'><td>Cell 3</td></tr> </TABLE> <input type='button' onclick='showhide("row1")' value='Row 1'> <input type='button' onclick='showhide("row2")' value='Row 2'> <input type='button' onclick='showhide("row3")' value='Row 3'> </BODY> </HTML> -------------- Reproducible: Always Steps to Reproduce: 1. Load example web page 2. Hide all table rows 3. Unhide one row
The default value of 'display' for TR elements from the user agent style sheet is 'table-row', not 'block'. Specifying 'display: block' for 'table-row' causes lots of anonymous table display objects to be constructed according to the rules in http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes . There is no such thing as 'display: hidden'. That said, the spec does define quite clearly what should happen when a table row is made 'display: block', etc., so there may be a bug here (our support for anonymous table display objects is a bit buggy), but it's probably not what you think.
Never mind the 'display:hidden' comment. That was used in the summary only, not the testcase.
Summary: Using style display:block->display:hidden -> display:block on <TR> elements causes incorrect table layout → Using style display:block->display:none -> display:block on <TR> elements causes incorrect table layout
dupe of "toggling btwn display: none and display: table-row inserts whitespace" via bug 198886 *** This bug has been marked as a duplicate of 97506 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: