W3C home > Mailing lists > Public > www-svg@w3.org > February 2012

Re: display:none and mixed SVG and HTML

From: Brian Birtles <birtles@gmail.com>
Date: Fri, 03 Feb 2012 12:03:49 +0900
Message-ID: <4F2B4E95.40603@gmail.com>
To: www-svg@w3.org
Thanks everyone for your feedback here.

Firstly, sorry if my previous mail sounded like I was pushing an agenda. 
I'm not heavily invested in any solution (hence the "feel free to 
contest this"), rather, like you all, I just want to clear up what 
authors should expect and implementors should aim for on this issue.

I am most certainly the least knowledgeable about CSS in this 
discussion, maybe this whole mailing list, but I'll make an attempt at 
summarising what I think are the issues that have been raised so far.

Consider the following example,

   <g style="display:none;fill:green;stroke:yellow">
     <pattern id="pattern">
       <circle cx="5" cy="5" r="5"/>
   <g style="fill:orange;stroke:red">
     <rect fill="url(#pattern)"/>

In this example, the <circle> inherits its fill and stroke from the 
parent <g> where it is defined, i.e. it is green with a yellow stroke. 
That is to say, the pattern is not just a shadow dom tree in the sense 
of a copy of the pattern's content, but rather it inherits its style 
from where it is defined.

As SVG says:

   Properties inherit into the 'pattern' element from its ancestors; 
properties do not inherit from the element referencing the 'pattern' 

This, of course, means computing style inside the display:none subtree. 
That's fine for SVG but for HTML computing style on display:none 
subtrees can be problematic. As Boris points out, at least counters, 
quotes, and animations will be affected by computing styles. In future 
there may be others. Tab has suggested workarounds for these cases. I 
don't think we've yet reached agreement about the suitability of the 

Putting this all into one monstrous test case:

   #main {
    counter-reset: section;
   h1:before {
    counter-increment: section;
    content: counter(section) ": ";
  <body id="main">
   <p style="display:none">
     <pattern id="pattern">
     <rect fill="url(#pattern)"/>
     <rect fill="url(#pattern)"/>

What is the expected result here?

Thanks again everyone for your help on this.

Best regards,


[1] www.w3.org/TR/SVG11/pservers.html#PatternElement
Received on Friday, 3 February 2012 03:04:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:34 UTC