[Catalyst] Re: Catalyst, Firefox and SVG

Robin Berjon robin.berjon at expway.fr
Mon Dec 12 17:19:00 CET 2005


Hi Maurice,

just for completeness's sake, I'll point out some red flags in your  
SVG document below. This is somewhat OT so anyone not doing SVG with  
Catalyst can safely ignore it.

On Dec 12, 2005, at 16:53, Maurice Height wrote:
> The SVG file: circle.svg
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

If your document is in UTF-8 or UTF-16 (as it should) you don't need  
the <?xml?> declaration. It's not harmful, but it's completely  
useless and a waste of good bytes.

The DOCTYPE you use is correct but very outdated. If you feel an  
urgent need to use a DOCTYPE, you should be using the 1.1 one. That  
being said, the DOCTYPE is also completely useless, a waste of bytes,  
and provides people with a false sense of validation (no DTD can  
properly validate a namespaced document). Starting with SVG 1.2  
(which is nearing publication) DTDs are deprecated and there will be  
no DOCTYPE to associate with SVG documents.

>     <circle cx="50" cy="200" r="0.5" style="fill: rgb(39,44,231)" />

You use the style attribute on most your elements. This has several  
downsides:
   a) it won't be supported by some implementations (CSS support is  
optional),
   b) it won't be supported by SVG Mobile implementations (which  
never use any CSS and where the style attribute doesn't exist),
   c) the style attribute is in the process of being deprecated. It  
will likely be dropped in SVG 1.3.

Instead use the XML syntax:

    <circle cx="50" cy="200" r="0.5" fill="rgb(39,44,231)"/>

This will work everywhere (including on a bunch of mobile phones),  
and is a lot cleaner.

Also note that there is no need to include a space before the "/>",  
that is only recommended for XHTML for backwards compatibility with  
HTML. It's not harmful but again, you're making SVG more verbose than  
it already is -- something not so easy to achieve ;-)

You also have seven circle elements with exactly the same fill.  
Instead use the g element to wrap them, which works because the fill  
property inherits:

   <g fill="rgb(39,44,231)">
     <circle cx="50" cy="200" r="0.5"/>
     <circle cx="70" cy="200" r="1"/>
     ...
   </g>

> <!--
>     Generated using the Perl SVG Module V2.33
>     by Ronan Oger
>     Info: http://www.roasp.com/
>  -->

Was the content entirely generated by SVG.pm? If so you should  
probably ask that the author fix those bugs.

-- 
Robin Berjon
    Senior Research Scientist
    Expway, http://expway.com/






More information about the Catalyst mailing list