Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox displaying tspan text in svg with opacity 0 (unlike all other modern browsers)

I was coming from this link with a problem about IE crashing when doing an svg animation using velocity.js .

And realized, hell, firefox is actually rendering svg text with opacity 0 in this jsbin .

reproduced with firefox 36

work arounds, fixes?

SVG

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
   width="949.574px" height="625.847px" viewBox="0 0 949.574 625.847" enable-background="new 0 0 949.574 625.847"
   xml:space="preserve">

<g>
  <g>
    <g>
      <path fill="#C4C6C8" d="M30.5,60.993c-5.386,0-10.703-1.446-15.376-4.184c-0.455-0.266-0.608-0.853-0.342-1.308
        c0.267-0.456,0.854-0.608,1.309-0.342c4.38,2.565,9.362,3.921,14.409,3.921c5.048,0,10.03-1.356,14.408-3.922
        c0.455-0.268,1.042-0.114,1.309,0.343c0.267,0.455,0.114,1.041-0.342,1.308C41.204,59.547,35.888,60.993,30.5,60.993z"/>
      <path fill="#C4C6C8" d="M9.55,52.259c-0.245,0-0.49-0.095-0.678-0.282C3.15,46.219,0,38.592,0,30.498
        c0-8.092,3.15-15.721,8.871-21.479c0.373-0.375,0.979-0.376,1.353-0.005c0.375,0.372,0.377,0.978,0.005,1.352
        c-5.363,5.399-8.316,12.55-8.316,20.133c0,7.585,2.953,14.733,8.316,20.131c0.372,0.375,0.37,0.979-0.004,1.353
        C10.037,52.166,9.794,52.259,9.55,52.259z"/>
      <path fill="#C4C6C8" d="M15.608,5.965c-0.328,0-0.648-0.168-0.826-0.473c-0.267-0.455-0.114-1.041,0.342-1.308
        C19.797,1.446,25.114,0,30.5,0s10.703,1.446,15.376,4.185c0.456,0.267,0.608,0.853,0.341,1.308
        c-0.267,0.456-0.853,0.61-1.308,0.343C40.528,3.269,35.546,1.912,30.5,1.912c-5.047,0-10.029,1.356-14.409,3.923
        C15.938,5.924,15.772,5.965,15.608,5.965z"/>
      <path fill="#C4C6C8" d="M51.449,52.259c-0.243,0-0.487-0.093-0.674-0.277c-0.375-0.373-0.377-0.978-0.005-1.353
        c5.363-5.396,8.316-12.546,8.316-20.131c0-7.584-2.953-14.733-8.315-20.133c-0.372-0.374-0.37-0.979,0.005-1.352
        c0.373-0.373,0.979-0.371,1.352,0.005C57.849,14.777,61,22.405,61,30.498c0,8.094-3.151,15.722-8.872,21.479
        C51.941,52.164,51.695,52.259,51.449,52.259z"/>
    </g>
    <polygon fill="#FFFFFF" points="30.5,44.277 16.5,23.028 30.5,23.028 44.5,23.028     "/>
  </g>

  <text transform="matrix(1 0 0 1 75 47.875)" fill="#FFFFFF" font-family="'AgfaRotisSansSerif'" font-size="36">f
  </text>
  <text transform="matrix(1 0 0 1 75 224.875)">
  <tspan class="tanim1 animated" style="opacity:0" x="0" y="0" fill="#FFFFFF"       font-size="36">e
  </tspan>
  <tspan class="tanim2 animated" style="opacity:0" x="0" y="86.4" fill="#FFFFFF"    font-size="36">d
  </tspan>
  <tspan class="tanim3 animated" style="opacity:0" x="0" y="172.8" fill="#FFFFFF"    font-size="36">c
  </tspan>
  <tspan class="tanim4 animated" style="opacity:0" x="0" y="252" fill="#FFFFFF"      font-size="30">b
  </tspan>
  <tspan class="tanim5 animated" style="opacity:0" x="0" y="288" fill="#FFFFFF"  font-size="30">a
  </tspan>
  <tspan class="tanim6 animated" style="opacity:0" x="0" y="324" fill="#FFFFFF"  font-size="30">z
  </tspan>
  <tspan class="tanim7 animated" style="opacity:0" x="0" y="360" fill="#FFFFFF" font-size="30">y
  </tspan>
  <tspan class="tanim8 animated" style="opacity:0" x="0" y="396" fill="#FFFFFF" font-size="30">x
  </tspan>
  </text>

  <line class="toBeAnimatedLine1 animated" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" x1="29" y1="70" x2="29" y2="70"></line>
  <line class="toBeAnimatedLine2 animated" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" x1="30" y1="212" x2="30" y2="212"/>
  <line class="toBeAnimatedLine3 animated" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" x1="30" y1="298" x2="30" y2="298"/>
  <line class="toBeAnimatedLine4 animated" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" x1="30" y1="385" x2="30" y2="385"/>
  <line class="toBeAnimatedLine5 animated" fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" x1="30" y1="468" x2="30" y2="468"/>
</g>
</svg>
like image 459
Toskan Avatar asked Mar 16 '23 20:03

Toskan


1 Answers

I actually used fill-opacity

http://jsbin.com/xoyalegipo/2/edit

 <tspan  fill-opacity="0.5" x="0" y="324" fill="#FFFFFF"  font-size="30">z
  </tspan>

which does not work in IE, even 11 so if ie, then style opacity else fill-opacity

...

like image 127
Toskan Avatar answered Apr 25 '23 08:04

Toskan