Re: inheritance of visibility from group

Hi Dave, hello world ;-)

David Dailey wrote:
> 
> In the simple example at http://cs.sru.edu/~ddailey/svg/visibilityTest.svg
> 
>  
> 
> The blue circle is inside an outer group while the red one is in a group 
> nested therein:
> 
> <g id="outer" visibility="visible">
> 
> <circle r="50" cx="300" fill="blue" onclick="Out()"/>
> 
> <g id="inner" visibility="visible">
> 
> <circle r="50" cx="100" fill="red" onclick="In()"/>
> 
> </g>
> 
> </g>
> 
>  
> 
> I rather expected that changing the visibility of “outer” would change 
> the visibility of all elements inside it. However, it doesn’t. Of course 
> I could solve the problem by having the inner group have 
> visibility=”inherit” (though this still suffers from the problem that an 
> initial test for visibility of the red circle:
> 
> IN=document.getElementById("inner")
> 
>                 if (IN.getAttribute("visibility")=="visible")
> 
>  
> 
> will fail since “visible” is not the same as “inherit.”
> 
>  
> 
> Since all browsers seem to agree with the handling, I would surmise that 
> the WG must have considered the issue at some time in the past and come 
> up with a reasoned decision, but I am a bit surprised as to why toggling 
> visibility on a <g> should not toggle visibility on all the stuff inside it.

For me, the behaviour is completely logical (and according to what the 
spec says, btw). If you overwrite the visibility of a child within an 
unvisible group, it should be visible, since the space for the element 
has been already reserved. If you want that you get all child elements 
invisible, for sure, you need to use display="none" for the parent, 
which makes the parent element as well as all its childs invisible, and 
does not reserve any space for them. So, no child can override the 
display property and become visible, again ...

Best regards,

Juergen Roethig

Received on Thursday, 25 July 2013 10:44:16 UTC