Hi,
I am trying to add an embedded <svg> image to the <body>. Second step
is to add a rect to the svg image. It works in JavaScript, following
lines creates a SVG rect in JS:
var newRect = document.createElementNS(svgNS, "rect");
newRect.setAttributeNS(null,"x", newElementX);
newRect.setAttributeNS(null,"y", newElementY);
newRect.setAttributeNS(null, "width", mousePosX - newElementX);
newRect.setAttributeNS(null, "height", mousePosY -
newElementY);
newRect.setAttributeNS(null, "fill", "white");
newRect.setAttributeNS(null, "stroke", "#4407f8");
newRect.setAttributeNS(null, "stroke", "#4407f8");
document.getElementById("svgDia").appendChild(newRect);
As a Java/C# developer, JavaScript is not my favorite language. So, I
am trying to get it work with Dart.
In Dart, it appends the svg element and the rect element to the DOM,
but they aren't recognized as SVG elements and therefore they aren't
visible on the HTML page.
Currently, Dart has no support for SVG (see Issue 311,
http://code.google.com/p/dart/issues/detail?id=311). Is there a
workaround to work with SVG, at least until the "Issue 311" is
resolved?
Thanks