dojo.place and html end tags (svg cirlce)

Game development with Board Game Arena Studio
Post Reply
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

dojo.place and html end tags (svg cirlce)

Post 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.
User avatar
Draasill
Posts: 197
Joined: 26 April 2020, 00:00

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

Post by Draasill »

Maybe just use element.innerHTML = '<svg...'> instead of dojo.place ?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

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

Post 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.
Post Reply

Return to “Developers”