Closed samhocevar closed 11 months ago
I realise that everything works properly if the SVG is built like this:
var canvas = SVG().addTo('#canvas').size('100%', '100%')
canvas.id('doc');
canvas.path('M0,0').id('a');
canvas.path('M0,0').id('b');
canvas.path('M0,0').id('c');
canvas.path('M0,0').id('d');
So maybe the problem lies within SVG.svg()
.
It's because of whitespaces
Changing this would be a major breaking change and therefore this is a wontfix until we decide to develop a v4
Bug report
Fiddle
https://jsfiddle.net/azqoxptd/
Explanation
I expect to see the following output:
Instead I see the following:
Everything is wrong with these lines:
a.position()
returns 1 (should be 0)a.prev()
returnsa
(should benull
)b.position()
returns 3 (should be 1)b.prev()
returnsc
(should bea
)c.prev()
returnsnull
(should beb
)Maybe this happens because the calls to
prev()
are inside an enumeration of the parent’s children? Anyway, if there are limitations and shortcomings with the use of these function, I could not find them in the documentation.