4xx / svg-edit

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

Odd behavior from nested layers in the SVG #1050

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Import or hand edit the SVG to have nested <g> layers, each with a title
2.
3.

What is the expected output? What do you see instead?
The layers that were nested showed as just part of the parent layer. Also, the 
titles of the layers were concatenated.

In what browser did you experience this problem? (ALL, Firefox, Opera, etc)
Only looked at Chrome, but assuming that this is svg-editor issue.

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

2.6

Please provide any additional information below.

I may add an enhancement to have nested layers show in the layer menu. But 
still since nested <g> is allowed both in terms of svg-edit not breaking or 
rejecting the svg (http://www.w3.org/TR/SVG/struct.html#Groups), there should 
be only the title of the parent layer shown and perhaps a warning that moving 
objects from layer to layer will only be in the highest group/layer level.

Original issue reported on code.google.com by dan...@citizencontact.com on 12 Feb 2013 at 2:39

GoogleCodeExporter commented 9 years ago
The concatenation of all titles seems easy to fix. In draw.js, line 355 reads
var name = $("title", child).text();

It should rather be only the first title, as in
var name = $("title:first", child).text();

Can somebody test and commit this fix?

Original comment by g...@hotmail.com on 15 Jul 2013 at 10:41

GoogleCodeExporter commented 9 years ago
On second thought, only use the first child, not the first descendant. ":first" 
could also be omitted since the W3C spec recommends a max of one title per 
element.

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

It seems that this issue is a duplicate of #885, and Carsten had the right 
solution from the start.

Original comment by g...@hotmail.com on 15 Jul 2013 at 8:27