Closed Bug 301269 Opened 19 years ago Closed 19 years ago

Changing element's display style resize element incorrectly

Categories

(SeaMonkey :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 97506

People

(Reporter: kevin, Unassigned)

References

Details

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

Using a JavaScipt to change an element's style.display property causes incorrect
element resize 

Reproducible: Always

Steps to Reproduce:
1.use the following HTML
<html>
<head>
<script language=JavaScript>
function showHideElm(strElmID, blnShow) {
  if (!document.getElementById)
    return;
  if (!document.getElementById(strElmID))
    return;
  var obj = document.getElementById(strElmID);
  if (!obj)
    return;
  if (blnShow)
    obj.style.display = 'Block';
  else
    obj.style.display = 'None';
}

function displayMore() {
  if (document.forms[0].chk.checked)
    showHideElm('tr1', true);
  else
    showHideElm('tr1', false);
}
</script>
</head>
<body>
<form>
<table width=70% border=1>
<tr>
<td>Label</td>
<td><input name="chk" type=checkbox onClick="displayMore();">Display more</td>
</tr>
<tr id="tr1" style="display:none">
<td>More stuff</td>
<td>More .. more .. </td>
</tr>
</table>
</form>
</body>
</html>
2.Save the HTML into a html and open it with Mozilla or Firefox
3.Click on display more
4.A new table row will be displayed

Actual Results:  
The new row has 2 incorrect sized cells

Expected Results:  
The table show display a new row without resize any cells nor the table
Related to/duplicate of Core bug 97506?
I have further test this problem and instead changing the style to "block", I
used  "" (empty string) and it seems to help (althought the sample HTML table
cell still move, but it works better).
You can also test with .style.display = 'inline'. That will also cause a problem.
Depends on: 162063
yes, "" is the better way to do what you want.

*** 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.