Search code examples
svgsafarisafari6

Safari 6 svg tag use issues


Link : http://jsfiddle.net/xkpeD/

or just

<svg width="300px" height="300px" version="1.1" xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink">
  <circle cx="50" cy="50" r="20" fill="pink" fill-opacity="0.5"/>
  <use xlink:href="#:example" x="20" y="20"/>
  <defs>
    <circle id=":example" cx="50" cy="50" r="20" fill="pink" fill-opacity="0.5"/>
  </defs>
</svg>​

It displays ok in all browsers (IE9, Chrome, Firefox, Safari 5.1), but in new Safari 6 only 1 circle is rendered. Seems that all <use> tags doesn't rendered in Safari 6.

Any help please?


Solution

  • sam.kozin's answer worked for me. Just so that this answer actually has visibility.

    Replace <use ... /> with <use ...></use>

    So:

    <svg width="300px" height="300px" version="1.1" xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink">
      <circle cx="50" cy="50" r="20" fill="pink" fill-opacity="0.5"/>
      <use xlink:href="#:example" x="20" y="20"></use>
      <defs>
        <circle id=":example" cx="50" cy="50" r="20" fill="pink" fill-opacity="0.5"/>
      </defs>
    </svg>​