I am experimenting with Aurelia custom attribute by testing a simple DOM manipulation.
To my surprise performing the manipulation by appending and ellipse node to the parent svg node does modify the HTML but doesn't render the ellipse.
Manipulating the innerHtml property does work as expected.
import { bindable, inject} from 'aureliaframework';
@inject(Element)
export class TestCustomAttribute {
constructor(private element: SVGElement) {
}
attached()
{
var ellipse = document.createElement("ellipse");
ellipse.setAttribute("cx","200");
ellipse.setAttribute("cy","200");
ellipse.setAttribute("rx","100")
ellipse.setAttribute("ry","100")
ellipse.setAttribute("style","fill:blue")
//this is rendered
this.element.innerHTML = "<ellipse style='fill: purple' cx='200' cy='200' rx='100' ry='100'></ellipse>"
//this shows on DOM explorer but not rendered
this.element.appendChild(ellipse)
}
Is it possible to achieve the desired result using appendNode() instead of manipulating the element innerHtml?