rebootcode / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

removeUnusedDefs is incorrectly removing items from whole svg document when it should only be removing from defs section. #929

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open svg document with embedded svg element
2. Add any item from Image Library (this will trigger creation of defs section)
3. Try to view svg source.

What is the expected output? What do you see instead?
The expected behavior is that the svg source should still contain the embedded 
svg element but in fact it does not. It is important to note that if you don't 
take an action that causes a defs section to be created the removeUnusedDefs 
method is short circuited so this behavior will not appear.

I have attached a patch that solves the problem.

Original issue reported on code.google.com by adamben...@gmail.com on 19 Mar 2012 at 10:56

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in r2069.

Pretty funny typo, considering even the var is called defelems. :P

Original comment by asyazwan on 26 Mar 2012 at 11:54

GoogleCodeExporter commented 8 years ago
That's kinda what I thought when I saw it... It made me to a triple take, and 
then some very careful testing to prove I really understood what I did. I 
suppose when I read someone else's code I always assume they were very 
deliberate and code that looks wrong, at first, is usually just caused by my 
lack of understanding.

Original comment by adamben...@gmail.com on 26 Mar 2012 at 5:29