Closed Bug 163451 Opened 22 years ago Closed 22 years ago

CSS STYLE.DISPLAY=NONE DOESNT HIDE P AND TABLE NESTED IN DIV

Categories

(Core :: DOM: CSS Object Model, defect)

x86
Windows 2000
defect
Not set
trivial

Tracking

()

RESOLVED DUPLICATE of bug 156206

People

(Reporter: bugzilla, Assigned: jst)

References

()

Details

Hi,

I'm probably retarded and haven't read the css2 spec close enuf but shouldn't
the table and p's dissapear when you set display to 'none' ?? i know things
might be different for block elements but i have tried numerous..
..blahabbbllaaa blaaa.

---TEST CASE FOLLOWS---

Regards,

Warren.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>why wont this damn thingy work</title>
<style type="text/css">
.hideable2{display:none;}
</style>
<script language="javascript" >
function show(name){
var g = document.getElementById(name) ;   
g.style.display ='inline' ;
}

function hide( name ) {
var g = document.getElementById(name) ;   
g.style.display ='none' ;
}
</script>
</HEAD>
<BODY>
<div class="hideable2" id="code">
<span>feed the code</span>
</div>
<a href="javascript:show('code');" >show</a>
<a href="javascript:hide('code');" >hide</a>

<br/>

<div class="hideable2" id="monkey">
<table><tr><td>monkey</td></tr></table>
</div>

<a href="javascript:show('monkey');" >show</a>
<a href="javascript:hide('monkey');" >hide</a>

<br/>
<div class="hideable2" id="banana">
<p>bananas</p>
</div>

<a href="javascript:show('banana');" >show</a>
<a href="javascript:hide('banana');" >hide</a>

</BODY>
</HTML>
*** Bug 163453 has been marked as a duplicate of this bug. ***
I checked this bug in Mozilla 1.1b. 

But, when I changed 'inline' to 'block' in hide function, it begun to work.
By default, DIV tag have 'block' display style.
Replace g.style.display ='inline' with g.style.display ='block' and it works...

The problem here is that the DIV container of the TABLE or the P is set by your JS
to inline but has block-level contents. We're still bad at inline-blocks,
aren't we ?
Status: UNCONFIRMED → NEW
Ever confirmed: true
thats correct, and your right it does work the display is set to block..
theres something fishy going on here..

element inherits display from enclosing div value none. - element is not displayed

javascript modifies dom & css style to display value inline. - element is
displayed presumably inline.

javascript modifies dom & css style to display value none. - element is still
displayed.

i'd still expect the element to display its "display" style, of none. or am i
upside down?

net result - am using block =)
*** This bug has been marked as a duplicate of 156206 ***

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