Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 999127 of Mozilla SVG Project

  • Revision slug: Mozilla_SVG_Project
  • Revision title: Mozilla SVG Project
  • Revision id: 999127
  • Created:
  • Creator: Tigt
  • Is current revision? No
  • Comment
Tags: 

Revision Content

Introduction

Since you have come this far, you probably already know that SVG stands for Scalable Vector Graphics, and that it is an XML language for sophisticated 2-dimensional graphics. SVG is to graphics what XHTML is to text, MathML is to mathematical equations and CML is to the description of chemical molecules.

SVG is similar in scope to Adobe's proprietary Flash technology: among other things it offers anti-aliased rendering, pattern and gradient fills, sophisticated filter-effects, clipping to arbitrary paths, text and animations. What distinguishes SVG from Flash, is that it is a W3C recommendation (i.e. a standard for all intents and purposes) and that it is XML-based as opposed to a closed binary format. It is explicitly designed to work with other W3C standards such as CSS, DOM and SMIL.

Firefox has natively supported SVG files since Firefox 1.5 (Gecko 1.8).

A simple example

In case you're curious what SVG looks like, here's an example:

<svg xmlns="https://www.w3.org/2000/svg"
     xmlns:xlink="https://www.w3.org/1999/xlink"
     version="1.1"
     baseProfile="full">
  <g fill-opacity="0.7" stroke="black" stroke-width="0.1cm">
    <circle cx="6cm" cy="2cm" r="100" fill="red"
                    transform="translate(0,50)" />
    <circle cx="6cm" cy="2cm" r="100" fill="blue"
                    transform="translate(70,150)" />
    <circle cx="6cm" cy="2cm" r="100" fill="green"
                    transform="translate(-70,150)" />
  </g>
</svg>

View this example 

The result should look something like the following (this was rendered by Mozilla Firefox 1.5):

Mozilla Firefox 1.5 rendering of SVG example

Native SVG vs. plug-in SVG

The Mozilla SVG implementation is a native SVG implementation. This is as opposed to plug-in SVG viewers such as the Adobe viewer.

Some of the implications of this are:

  • Mozilla can handle documents that contain SVG, MathML, XHTML, XUL, etc. all mixed together in the same 'compound' document. This is being made possible by using XML namespaces.
  • Mozilla is 'aware' of the SVG content. It can be accessed through the SVG DOM (which is compatible with the XML DOM) and manipulated by Mozilla's script engine.
  • Other Mozilla technologies can be used with SVG. XBL coupled with SVG is a particular interesting combination. It can be used to create graphical widgets (I wonder when we'll see the first SVG-based chrome!) or extend Mozilla to recognize other specialized languages such as e.g. CML (chemical markup language). There are samples of these kinds of more advanced usage patterns on croczilla.com/svg/.

Status

Gecko 1.8 added SVG support and hence it is included in Mozilla Firefox versions 1.5 and greater.

The goal we're working towards with Mozilla's SVG implementation is SVG 1.1 Full. What exists now in the tree should be treated as a technology preview. As we implement more of the specification, content written against Mozilla's SVG implementation might break if it unintentionally relies on bugs that are fixed. We realize this is not ideal, but ask you be patient as we continue implementing an extremely large specification that lacks a comprehensive test suite.

Our goal is specification conformance. Where the specification and other implementations of SVG differ, we will conform to the specification. Where the specification is ambiguous, we will make an informed decision, consulting the SVG working group and other experts as appropriate.

While we are still a long way away from full SVG support, the subset currently implemented is already pretty usable. We have support for all basic shapes including beziers, stroking and filling with opacity, gradients, scripting, events, and much of the DOM.

Big areas of the SVG specification where we're still lacking include filters, svg defined fonts, and declarative animations. A page listing the current implementation status of svg elements and the rendering backends can be found at Mozilla SVG Status.

Getting Involved

SVG 1.1 is a big specification and we still have a lot of work to do to fully implement it. If you think you can help us by e.g. tracking down bugs, writing some test-cases or implementing some outstanding features, please get in touch.

We have an IRC chat channel, #svg, on irc.mozilla.org.

There is also newsgroup/mailing list dedicated to SVG in Mozilla. It's called mozilla.dev.tech.svg.

If reporting bugs, the best place for them is in bugzilla so that we can track them and you can monitor the progress. File them in the "Core" product with the "SVG" component. If you have a testcase (which we love to have), please use the attachment feature of bugzilla to include it rather than pasting it in the bug.

Frequently Asked Questions

Before asking us questions directly, please take a look at the Frequently Asked Questions page to see if your question has already been answered. If your question hasn't been answered there, try asking in our newsgroup or IRC channel.

Mozilla-specific SVG sites

General resources

Original Document Information

  • Author(s): Dean Jackson
  • Other Contributors: Alex Fritze, Robert Mohr, Tim Rowley, Jonathan Watt, Steffen Wilberg
  • Last Updated Date: February 1, 2006
  • Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details.

{{ languages( { "ja": "ja/Mozilla_SVG_Project" } ) }}

Revision Source

<h3 id="Introduction" name="Introduction">Introduction</h3>

<p>Since you have come this far, you probably already know that SVG stands for Scalable Vector Graphics, and that it is an XML language for sophisticated 2-dimensional graphics. SVG is to graphics what XHTML is to text, MathML is to mathematical equations and CML is to the description of chemical molecules.</p>

<p>SVG is similar in scope to Adobe's proprietary Flash technology: among other things it offers anti-aliased rendering, pattern and gradient fills, sophisticated filter-effects, clipping to arbitrary paths, text and animations. What distinguishes SVG from Flash, is that it is a W3C recommendation (i.e. a standard for all intents and purposes) and that it is XML-based as opposed to a closed binary format. It is explicitly designed to work with other W3C standards such as CSS, DOM and SMIL.</p>

<p>Firefox has natively supported SVG files since&nbsp;<a class="internal" href="/en/Firefox_1.5_for_developers" title="En/Firefox 1.5">Firefox 1.5</a> (<a class="internal" href="/en/Gecko" title="En/Gecko">Gecko</a> 1.8).</p>

<h4 id="A_simple_example" name="A_simple_example">A simple example</h4>

<p>In case you're curious what SVG looks like, here's an example:</p>

<pre>
&lt;svg xmlns="https://www.w3.org/2000/svg"
     xmlns:xlink="https://www.w3.org/1999/xlink"
     version="1.1"
     baseProfile="full"&gt;
  &lt;g fill-opacity="0.7" stroke="black" stroke-width="0.1cm"&gt;
    &lt;circle cx="6cm" cy="2cm" r="100" fill="red"
                    transform="translate(0,50)" /&gt;
    &lt;circle cx="6cm" cy="2cm" r="100" fill="blue"
                    transform="translate(70,150)" /&gt;
    &lt;circle cx="6cm" cy="2cm" r="100" fill="green"
                    transform="translate(-70,150)" /&gt;
  &lt;/g&gt;
&lt;/svg&gt;
</pre>

<p><a class="internal" href="/@api/deki/files/3540/=simple.svg" title="/@api/deki/files/3540/=simple.svg">View this example</a>&nbsp;</p>

<p>The result should look something like the following (this was rendered by Mozilla Firefox 1.5):</p>

<p><img alt="Mozilla Firefox 1.5 rendering of SVG example" class="internal" src="/@api/deki/files/607/=Circles.png" /></p>

<h4 id="Native_SVG_vs._plug-in_SVG" name="Native_SVG_vs._plug-in_SVG">Native SVG vs. plug-in SVG</h4>

<p>The Mozilla SVG implementation is a <strong>native</strong> SVG implementation. This is as opposed to <strong>plug-in</strong> SVG viewers such as the <a class="external" href="https://www.adobe.com/svg/">Adobe viewer</a>.</p>

<p>Some of the implications of this are:</p>

<ul>
 <li>Mozilla can handle documents that contain SVG, MathML, XHTML, XUL, etc. all mixed together in the same 'compound' document. This is being made possible by using <a href="/en/SVG/Namespaces_Crash_Course" title="en/SVG/Namespaces_Crash_Course">XML namespaces</a>.</li>
 <li>Mozilla is 'aware' of the SVG content. It can be accessed through the <a class="external" href="https://www.w3.org/TR/SVG/svgdom.html">SVG DOM</a> (which is compatible with the XML DOM) and manipulated by Mozilla's script engine.</li>
 <li>Other Mozilla technologies can be used with SVG. <a href="/en/XBL" title="en/XBL">XBL</a> coupled with SVG is a particular interesting combination. It can be used to create graphical widgets (I wonder when we'll see the first SVG-based chrome!) or extend Mozilla to recognize other specialized languages such as e.g. CML (chemical markup language). There are samples of these kinds of more advanced usage patterns on <a class="external" href="https://www.croczilla.com/svg/">croczilla.com/svg/</a>.</li>
</ul>

<h3 id="Status" name="Status">Status</h3>

<p><a href="/en/Gecko" title="En/Gecko">Gecko</a> 1.8 added SVG support and hence it is included in <a class="external" href="https://www.mozilla.com/firefox/">Mozilla Firefox</a> versions 1.5 and greater.</p>

<p>The goal we're working towards with Mozilla's SVG implementation is <a class="external" href="https://www.w3.org/TR/SVG11/">SVG 1.1 Full</a>. What exists now in the tree should be treated as a technology preview. As we implement more of the specification, content written against Mozilla's SVG implementation might break if it unintentionally relies on bugs that are fixed. We realize this is not ideal, but ask you be patient as we continue implementing an extremely large specification that lacks a comprehensive test suite.</p>

<p>Our goal is specification conformance. Where the specification and other implementations of SVG differ, we will conform to the specification. Where the specification is ambiguous, we will make an informed decision, consulting the SVG working group and other experts as appropriate.</p>

<p>While we are still a long way away from full SVG support, the subset currently implemented is already pretty usable. We have support for all basic shapes including beziers, stroking and filling with opacity, gradients, scripting, events, and much of the DOM.</p>

<p>Big areas of the SVG specification where we're still lacking include filters, svg defined fonts, and declarative animations. A page listing the current implementation status of svg elements and the rendering backends can be found at <a href="/en/Mozilla_SVG_Status" title="en/Mozilla_SVG_Status">Mozilla SVG Status</a>.</p>

<h3 id="Getting_Involved" name="Getting_Involved">Getting Involved</h3>

<p>SVG 1.1 is a big specification and we still have a lot of work to do to fully implement it. If you think you can help us by e.g. tracking down bugs, writing some test-cases or implementing some outstanding features, please get in touch.</p>

<p>We have an IRC chat channel, #svg, on <a class="link-irc" href="irc://irc.mozilla.org/%23svg">irc.mozilla.org</a>.</p>

<p>There is also newsgroup/mailing list dedicated to SVG in Mozilla. It's called <a class="external" href="nntp://news.mozilla.org/mozilla.dev.tech.svg">mozilla.dev.tech.svg</a>.</p>

<p>If reporting bugs, the best place for them is in <a class="link-https" href="https://bugzilla.mozilla.org/">bugzilla</a> so that we can track them and you can monitor the progress. File them in the <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&amp;component=SVG">"Core" product with the "SVG" component</a>. If you have a testcase (which we love to have), please use the attachment feature of bugzilla to include it rather than pasting it in the bug.</p>

<h3 id="Frequently_Asked_Questions" name="Frequently_Asked_Questions">Frequently Asked Questions</h3>

<p>Before asking us questions directly, please take a look at the <a class="internal" href="/En/SVG/FAQ" title="En/SVG/FAQ">Frequently Asked Questions</a> page to see if your question has already been answered. If your question hasn't been answered there, try asking in our <a class="external" href="nntp://news.mozilla.org/mozilla.dev.tech.svg">newsgroup</a> or <a class="link-irc" href="irc://irc.mozilla.org/%23svg">IRC channel</a>.</p>

<h3 id="Links" name="Links">Links</h3>

<h4 id="Mozilla-specific_SVG_sites" name="Mozilla-specific_SVG_sites">Mozilla-specific SVG sites</h4>

<ul>
 <li><a class="external" href="https://www.croczilla.com/svg/">Mozilla SVG Resources</a></li>
 <li><a class="external" href="https://www.croczilla.com/svg/samples/">Mozilla SVG Samples</a></li>
</ul>

<h4 id="General_resources" name="General_resources">General resources</h4>

<ul>
 <li>The W3C's <a class="external" href="https://www.w3.org/Graphics/SVG/">SVG site</a>.</li>
 <li>Jonathan Watt's <a class="external" href="https://jwatt.org/svg/authoring/">SVG authoring guidelines</a>. Give your SVG a much better chance of working in all SVG implementations by following these guidelines.</li>
 <li>The <a class="external" href="https://svg-whiz.com/wiki/">SVG wiki</a>.</li>
 <li>The <a href="/en/SVG" title="en/SVG">SVG section of the Mozilla Developer Center</a>.</li>
 <li>For general SVG questions there is a mailing list at <strong><a class="link-mailto" href="mailto:[email protected]" rel="freelink">[email protected]</a></strong> (<a class="external" href="https://lists.w3.org/Archives/Public/www-svg/">archived here</a>).</li>
 <li>Another useful and very busy newsgroup/mailing list is <strong><a class="link-mailto" href="mailto:[email protected]" rel="freelink">[email protected]</a></strong> (<a class="external" href="https://news.gmane.org/gmane.text.xml.svg.devel/">archived here</a>).</li>
</ul>

<div class="originaldocinfo">
<h2 id="Original_Document_Information" name="Original_Document_Information">Original Document Information</h2>

<ul>
 <li>Author(s): Dean Jackson</li>
 <li>Other Contributors: Alex Fritze, Robert Mohr, Tim Rowley, Jonathan Watt, Steffen Wilberg</li>
 <li>Last Updated Date: February 1, 2006</li>
 <li>Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | <a class="external" href="https://www.mozilla.org/foundation/licensing/website-content.html">Details</a>.</li>
</ul>
</div>

<p>{{ languages( { "ja": "ja/Mozilla_SVG_Project" } ) }}</p>
Revert to this revision