rebootcode / svg-edit

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

Layer Names wrong if layer contains named group elements as children #855

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create empty image and add two arbitrary elements to it
2. Group the two elements and then enter a name (say "test") into the label 
field
3. Show the raw svg and then press okay

What is the expected output? What do you see instead?
If you now open the layer sidebar you see "Layer 1test" that instead of "Layer 
1" as label

In what browser did you experience this problem? (ALL, Firefox, Opera, etc)
ALL

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

Please provide any additional information below.
The problem is the computation of the layer name in line 358 in draw.js which 
currently is:

var name = $("title",child).text();

This makes jquery fetch the text body of all title elements under the "child" 
node (in this case the layer). This is wrong. Instead we can use the children() 
selector from jquery to fetch the text body only from immediate children of the 
group element like this (see also patch attached to this issue):

var name = $(child).children("title").text();  

Original issue reported on code.google.com by carsten.block@gmail.com on 16 Sep 2011 at 8:17

Attachments: