Closed Bug 307484 Opened 19 years ago Closed 19 years ago

Setting style.display to none does not update the elements with postion.absolute

Categories

(SeaMonkey :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: martin.koegler, Unassigned)

Details

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 an element is hidden by stetting style.display to none with JavaScript, the
postion of elements with CSS postion:absolute; is not adjusted. If an other
element is made visible (setting style.display to eg. block), the postion of
elements with CSS postion:absolute; are adjusted.

It is sufficient to set a display attribute to block and immediatly again to
none to trigger the adjustment.

Internet Explorer is adjusting the absolute elements, if display is set to none.


Reproducible: Always

Steps to Reproduce:
The following example is a little menu with an input element for each menu
entry. If you close the an open menu, some input fields associated with a entry
stay at the same place. If you open a menu, all input fields are moved to their
element.

1. Click on the first link after loading the page

<html><head><style>
input.li3 { position: absolute; width:10px;}
</style>
</head><body>
<script type="text/Javascript">
function test(n)
{
if(document.getElementById(n).style.display=='none')
{
if(n!='i1')
document.getElementById('i1').style.display='none';
if(n!='i2')
document.getElementById('i2').style.display='none';
if(n!='i3')
document.getElementById('i3').style.display='none';
document.getElementById(n).style.display='block';
}
else
{
document.getElementById(n).style.display='none';
//document.getElementById(n).style.display='block';
document.getElementById(n).style.display='none';
}
}

</script>
<div><input class="li3"><a
href="javascript:test('i1')">xxxxxxxxxxxxxxxxxxxxxx<br></a></div>
<div id="i1" style="display: block;">
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
</div>
<div><input class="li3"><a
href="javascript:test('i2')">xxxxxxxxxxxxxxxxxxxxxx<br></a></div>
<div id="i2" style="display: none;">
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
</div>
<div><input class="li3"><a
href="javascript:test('i3')">xxxxxxxxxxxxxxxxxxxxxx<br></a></div>
<div id="i3" style="display: none;">
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
<div><input class="li3">xxxxxxxxxxxxxxxxxxxxxx<br></div>
</div>
</div>
</body></html>

If // is removed from comment line in the Javascript, for the close operation,
all input elements are also moved to the right postion.


Actual Results:  
Some input elements stay after a click at their places, while other are placed
over their menu entry. 

Expected Results:  
All visible input elements should be placed over their menu entry.
Please test again with a nightly build, to see if it works:
http://mozilla.isc.org/pub/mozilla.org/firefox/nightly/latest-trunk/
The problem is fixed in the nightly build.
Ok, marking WFM then.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.