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

L. David Baron wrote:
> On Thursday 2008-02-14 02:03 -0800, fantasai wrote:
>> Specifically, block-level elements with "visibility: collapse" should behave as
>> if their box was zero height with zero vertical padding, border width, and margins,
>> and inline-level elements with "visibility: collapse" should behave as if their
>> box was zero width with zero horizontal padding, border width, and margins.
>> Furthermore all descendants of a non-internal-table-element with "visibility:
>> collapse"--including descendants that are anonymous boxes--are also treated as
>> if they had "visibility: collapse".
> 
> Is there a compelling use case for this?  Do authors want it for
> some reason?  It's a good bit of work to implement, and it's not
> worth doing that work just to make the property semantics more
> aesthetically pleasing to spec designers.
> 
> -David
> 

Hi, David,

Reason is very simple and is widespread especially recently.

Dynamic show/hide of elements. Used in many circumstances in scripts and 
in static CSS declarations.

Example #1: I want to define shown/hidden state of .dependent all 
elements based on value of body[mode="foo|bar"] attribute:

body[mode="foo"] .dependent
{
   display: none; /* to hide */
}

body[mode="bar"] .dependent
{
   display: ???; /* what to put here to show arbitrary element so to 
discard display:none? */
}

Example #2: AJAX "devilopment", the same problem - we need some 
attribute that has single value for "shown" state.

var el = ...;
     el.style.display = "none"; // to hide
     el.style.display = "????"; // how exactly to define "show" ?

Search the web on 'style.display = "block"' phrase and you will get list 
of links. Almost every link there leads to potentially erroneous code.

Best regards,

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Thursday, 14 February 2008 17:23:30 UTC