Scour doesn't handle <style> elements well

Bug #368716 reported by codedread on 2009-04-28
2
Affects Status Importance Assigned to Milestone
Scour
Undecided
codedread

Bug Description

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.

Note for the second problem that you can use the new option --disable-style-to-xml to prevent the style properties from being converted into XML attributes. However, it would be nice if scour prevented the conversion automatically somehow.

codedread (codedread) on 2009-04-28
description: updated
codedread (codedread) on 2009-07-28
Changed in scour:
status: New → Confirmed
codedread (codedread) wrote :

Fixed in r142, will be in scour-0.20

Changed in scour:
assignee: nobody → codedread (codedread)
status: Confirmed → Fix Committed
codedread (codedread) on 2009-09-11
Changed in scour:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers