Re: [CSS21] visibility: collapse on non-table elements

L. David Baron wrote:
> On Thursday 2008-02-14 09:23 -0800, Andrew Fedoniouk wrote:
>> Dynamic show/hide of elements. Used in many circumstances in scripts and in 
>> static CSS declarations.
> 
> In what cases would this proposed feature be needed where
> display:none is not sufficient?

display:none makes the element completely invisible for
layout (placement calculation) algorithm.

In cases like this:
http://blogs.grf-design.com/060405/
visibility:collapsed is highly desirable for computation of
panels inside this "accordion".

visibility:collapsed here is close to combination of following:

   overflow:hidden;
   height:0;
   min-width: min-intrinsic;


> 
>> body[mode="bar"] .dependent
>> {
>>   display: ???; /* what to put here to show arbitrary element so to discard 
>> display:none? */
>> }
> 
> Put nothing at all; the rule with display:none doesn't match
> anymore.

Generally true but not so convenient.

> 
>> var el = ...;
>>     el.style.display = "none"; // to hide
>>     el.style.display = "????"; // how exactly to define "show" ?
> 
> I use el.style.display="" quite often and it works fine for this.
> 

That would work if this element has computed value of @display other 
than "none". If such element was initially defined as display:none then
el.style.display="" will lead to display:none.

OT: I think that el.style.display = null; is better to express intention 
of clearing local value of style attribute. I am not sure but empty 
string should not be a valid value of display attribute.


-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Friday, 15 February 2008 07:11:06 UTC