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

RESOLVED DUPLICATE of bug 156206

Status

()

Core
DOM: CSS Object Model
--
trivial
RESOLVED DUPLICATE of bug 156206
16 years ago
16 years ago

People

(Reporter: warren crossing, Assigned: jst)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

16 years ago
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>

Comment 1

16 years ago
*** Bug 163453 has been marked as a duplicate of this bug. ***

Comment 2

16 years ago
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
(Reporter)

Comment 4

16 years ago
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 =)

Comment 5

16 years ago
*** This bug has been marked as a duplicate of 156206 ***

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