Comment 0 for bug 368716

Revision history for this message
codedread (codedread) wrote :

Scour doesn't yet handle <style> elements well. There are two sub-bugs with this:

1) if a CSS selector references an element, scour doesn't detect this so in the following file:

<svg>
<defs>
  <style>
    .foo { filter: url(#myfilter); }
  </style>
  <filter id="myfilter" .../>
</defs>
<rect class="foo" ... />
</svg>

The myfilter filter will get removed because scour doesn't think it's referenced anywhere. I'll need to build a crude CSS parser for scour to deal with this.

2) conversion from style properties to XML attributes presents a problem with a <style> element:

<svg>
<style>
  rect { fill: blue; }
</style>
<rect style="fill:red" .../>
</svg>

In this case, scour will convert the rect's style to: <rect fill="red"... />.

This probably isn't what is intended because the <style>'s rect rule (fill:blue) overrides the fill attribute. So the rectangle is blue in the scoured SVG, though the original SVG file has the rectangle as red.