Scour doesn't handle <style> elements well

Bug #368716 reported by codedread
Affects Status Importance Assigned to Milestone
Fix Released

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:

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

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:

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

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)
description: updated
codedread (codedread)
Changed in scour:
status: New → Confirmed
Revision history for this message
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)
Changed in scour:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.