Closed pragdave closed 4 years ago
Or.. is the canonical way to do
let el = SVG.SVG(some svg)
draw.add(el)
I'm guessing this behavior is because svg() can accept multiple SVG elements, and so the choice of return value is ambiguous
Correct!
Perhaps it could just return the first?
Thats a good idea but would introduce a breaking change
Or.. is the canonical way to do
This will create an element based on the first element of the given string. So jeah - if it is only one element this way is the prefered one
Thanks
Bug report
It looks like
Dom.svg()
is returning the parent element, and not the newly created internal svg element.Fiddle
Here's a pen: https://codepen.io/pragdave/pen/qBbREKO
Explanation
I can't use
nested()
because:I need the embedded SVG's attributes to be directly exposed, and
nested
returns a DOM element, not a container.I'm guessing this behavior is because
svg()
can accept multiple SVG elements, and so the choice of return value is ambiguous. Perhaps it could just return the first?Cheers
Dave