rebootcode / svg-edit

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

Edit Source failing with unused def elements #998

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Main Menu -> Image Library -> Demo Library
2. click smiley.svg
3. See smiley on the canvas
4. Click Edit Source
5. Remove the following use statement.
  <use x="0" y="0" transform="matrix(1.16788 0 0 1.16788 0 0)" xlink:href="#svg_5" id="svg_6"/>
6. Click Apply Changes
7. Click Edit Source
6. See the following exception
Uncaught TypeError: Cannot call method 'getAttribute' of undefined 
svgcanvas.js:5031
removeUnusedDefElems.removeUnusedDefElems svgcanvas.js:5031
svgCanvasToString svgcanvas.js:5068
getSvgString svgcanvas.js:5386
window.svgEditor.Editor.init.showSourceEditor svg-editor.js:2749
f.event.dispatch jquery.js:3
f.event.add.h.handle.i jquery.js:3

What is the expected output? What do you see instead?
Expected to see the Edit Source view.

In what browser did you experience this problem? (ALL, Firefox, Opera, etc)
Windows 7
Chrome 21.0.1180.75 m

In what version of SVG-edit does the problem occur? (Latest trunk, 2.5.1,
etc)
Latest trunk

Please provide any additional information below.
patch file attached.

removeUnusedDefElems is called twice. The first time it works. The second time 
through,
svgcontent.getElementsByTagNameNS(svgns, '*') returns an array with some empty 
elements.

Original issue reported on code.google.com by fobr...@greenenergycorp.com on 10 Aug 2012 at 8:47

Attachments: