Closed
Bug 138142
Opened 23 years ago
Closed 21 years ago
property margin not recognized if property display dynamically set
Categories
(Core :: Layout: Block and Inline, defect)
Core
Layout: Block and Inline
Tracking
()
RESOLVED
FIXED
People
(Reporter: dietmar.rabich, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(2 files)
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.9) Gecko/20020311
BuildID: 2002031104
Look at this source:
<html>
<head>
<style type="text/css">
#a, #b
{
display: none;
}
</style>
<script>
<!--
function chg(id)
{
var el = document.getElementById(id)
el.style.display = (el.style.display == '' || el.style.display == 'none') ?
'block' : 'none'
}
//-->
</script>
</head>
<body>
<p><span onClick="chg('a')">A</span> <span onClick="chg('b')">B</span></p>
<div>
<p id="a">Example A</p>
<p id="b">Example B</p>
</div>
</body>
</html>
If the document is shown, you see first only "A" and "B". Click on "A", you see
"Example A", click on "B", you see "Example B". Between "Example A" and "Example
B" is a distance (from margin).
Reload the document.
Do the same as before, but first "B", then "A". There is no distancs between
"Example A" and "Example B".
If you omit the tags <div> and </div> everything works fine.
Reproducible: Always
Steps to Reproduce:
1. If the document ist shown, you see first only "A" and "B". Click on "A", you
see "Example A", click on "B", you see "Example B". Between "Example A" and
"Example B" is a distance (from margin).
2. Reload the document.
3. Do the same as before, but first "B", then "A". There is no distancs between
"Example A" and "Example B".
Actual Results: See description and the reproduce steps.
Expected Results: Same behaviour without consideration of the order of clicking.
| Reporter | ||
Updated•23 years ago
|
Component: XP Apps → Style System
Comment 1•23 years ago
|
||
Comment 2•23 years ago
|
||
To layout. Seeing this on current linux too.
Assignee: sgehani → attinasi
Status: UNCONFIRMED → NEW
Component: Style System → Layout
Ever confirmed: true
OS: Windows NT → All
QA Contact: paw → petersen
Hardware: PC → All
Comment 4•23 years ago
|
||
Adding the testcase keyword and setting the priority.
Keywords: testcase
Priority: -- → P3
Updated•23 years ago
|
Target Milestone: --- → Future
Comment 5•22 years ago
|
||
The bug shows up just as well when changing node.className to apply different rules.
The bug most likely occurs when changing the display property of an element
which should have a margin below it other than because its containing
element has a bottom margin. You don't need two elements to show the problem.
The nastiest side effect is that page coordinates used for a DOM update may
be invalidated during processing the update if margination is corrected.
Comment 6•22 years ago
|
||
A testcase with one dynamic element:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Gecko Top Margin Error</title>
<script type="text/javascript">
function display(id,value)
{
var node;
node=document.getElementById(id);
node.style.display=value;
return false;
}
</script>
</head>
<body>
<div>
[Before container division #c]
</div>
<div id=c>
<p id=a style="display: none;">
a paragraph #a
</p>
</div>
<div>
[After container division #c]
</div>
<blockquote>
Click <a href="#" onclick='return display("a","block")'>display=block</a> to
show #a.<br>
Click <a href="#" onclick='return display("a","none")'>display="none"</a> to
hide #a.<br>
Resize the page after each click to correct margins.<br>
</blockquote>
</body>
</html>
Comment 7•22 years ago
|
||
I believe I know what the bug is (now).
Description: margins around elements switched using CSS display property
values of "block" and "none" are incorrectly calculated under particular
circumstances when performing DOM updates from script.
Platforms: all (Win98,WinXP,linux tested)
Browsers: Netscape, Gnome Galion, Mozilla (1.3a tested)
Algorithmic error: dynamic update code only searches amoungst siblings
of the switched node to find elements which supply, or are ancestors
of elements which supply, preceding element margin-bottom and
following element margin-top values. If the switched node's parent
is not a common ancestor of the elements sought, update code will
proceed with substituted or unaltered values - the screen and
DOM then reflect bad element positions until the next layout.
Comment 8•22 years ago
|
||
.
Assignee: attinasi → block-and-inline
Component: Layout → Layout: Block & Inline
Priority: P3 → --
QA Contact: amar → ian
Target Milestone: Future → ---
Comment 9•21 years ago
|
||
Click on the buttons to show/hide a content for the items in the list. The
"content" has a bottom margin which doesn't show (and hide) until one doesn't
push the "Show/Hide" for the next item in the list.
Comment 10•21 years ago
|
||
Fixed by checkin for bug 257612
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•