SVG Elements don't show

41 views
Skip to first unread message

Lars Tackmann

unread,
Dec 28, 2011, 11:11:47 PM12/28/11
to General Dart Discussion
Hi

If you add a SVG element to a Dart app then it does not show, the very
same SVG markup works fine outside Dart. Is this a bug or is there
some property that I need to enable SVG ? (both display and visibility
are correctly set).

I wiped together a gist that shows the problem (tested with frogc
build 2817 and DartEditor build 2804)

https://gist.github.com/1531821




Stephen Adams

unread,
Dec 28, 2011, 11:33:25 PM12/28/11
to Lars Tackmann, General Dart Discussion
SVG is not yet fully supported by dart:html.  That is probably the issue you are seeing.

(There is already a bug open on SVG  - http://code.google.com/p/dart/issues/detail?id=772
If you think it is exactly the same issue, add to that, otherwise create a new issue.)

Thanks for creating a nice test case.

Lars Tackmann

unread,
Dec 28, 2011, 11:49:22 PM12/28/11
to General Dart Discussion


On Dec 29, 5:33 am, Stephen Adams <s...@google.com> wrote:
> SVG is not yet fully supported by dart:html.  That is probably the issue
> you are seeing.
>
> Can you file a bug athttp://code.google.com/p/dart/issues/list?
> (There is already a bug open on SVG  -http://code.google.com/p/dart/issues/detail?id=772
> If you think it is exactly the same issue, add to that, otherwise create a
> new issue.)
>
> Thanks for creating a nice test case.
>

Not sure its the same. The code I have made correctly inserts the SVG
element into the page and no JavaScript errors are produced. However
nothing is shown!.

If I add the following svg markup to the HTML page by hand

<svg height="100" version='1.1'>
<ellipse cx="740" cy="60" rx="50" ry="25" fill="red"/>
</svg>

Then it shows correctly. But if I try to access it from Dart:

Element svg = document.query("svg");
svg.attributes = {
"height": 250,
"width": 250,
"version": "1.1"
};

then the attributes are correctly updated in the DOM but the actual
SVG picture does not show any more.

I will fill a new bug


--
Lars

Lars Tackmann

unread,
Dec 28, 2011, 11:56:01 PM12/28/11
to General Dart Discussion

Lars Tackmann

unread,
Jan 4, 2012, 3:04:16 PM1/4/12
to General Dart Discussion
Issue fixed it turned out one need to use SVGElement.tag rather than
Element.tag

Updated the gist https://gist.github.com/1531821 to show how to use
SVG in Dart.

Thanks for the help.

Bob Nystrom

unread,
Jan 4, 2012, 5:06:09 PM1/4/12
to Lars Tackmann, General Dart Discussion
On Wed, Jan 4, 2012 at 12:04 PM, Lars Tackmann <ltac...@gmail.com> wrote:
Issue fixed it turned out one need to use SVGElement.tag rather than
Element.tag

\o/

- bob

Reply all
Reply to author
Forward
0 new messages