inheritance of visibility from group

Hi all,

 

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.

 

Cheers

David

Received on Tuesday, 23 July 2013 14:22:07 UTC