Scour doesn't handle <style> elements well

Bug #368716 reported by codedread
2
Affects Status Importance Assigned to Milestone
Scour
Fix Released
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)
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.