Page 1 of 1

dojo.place and html end tags (svg cirlce)

Posted: 12 June 2020, 11:34
by RicardoRix
Hi.

I am trying to use dojo.place to add an svg circle element onto a div.

The problem seems to lie in the fact that the svg circle tag MUST be the short hand version:
<circle class="stationTokenCircle" cx="${x}" cy="$10" r="12" />

Code: Select all

var svg_stationTokenC = '<circle stroke="black" stroke-width="1" fill="white" cx="${x}" cy="${y}" r="12" />';
BUT after dojo.place, it expands this to the longer standard version.
<circle class="stationTokenCircle" cx="10" cy="10" r="12"></circle>

..and this now doesn't render properly, I don't know why.

If I go to F12 console and select 'Edit Html' and manually change the end of the </circle> to /> then it now renders.

I've tried a few different ways to dojo.place the svg, circle and a text tag, sometimes dojo even places the text div inside the circle which I didn't ask it to do.

Re: dojo.place and html end tags (svg cirlce)

Posted: 12 June 2020, 13:00
by Draasill
Maybe just use element.innerHTML = '<svg...'> instead of dojo.place ?

Re: dojo.place and html end tags (svg cirlce)

Posted: 12 June 2020, 13:45
by RicardoRix
Draasill wrote: 12 June 2020, 13:00 Maybe just use element.innerHTML = '<svg...'> instead of dojo.place ?
Yes, that works, thx!

It didn't occur to me, mainly because I most use dojo.place and I'm new to the svg tags, so was getting blinkered by that as well.