SVG foreignObject not visible

1,542 views
Skip to first unread message

Adrian

unread,
May 15, 2014, 4:57:00 AM5/15/14
to racti...@googlegroups.com
Hi there, 

I've been trying out ractive and so far it's great, thanks for the hard work put into this. 

There is a scenario that I've found and I'm not sure where the problem is, so if anyone stumbled into this and could help me out I'd appreciate it.
It's just a simple svg with a foreign object tag inside that isn't displayed even if the resulting DOM looks right. 

You can try out a demo here : http://jsfiddle.net/YF9Te/  (the 'Hello there' text isn't visible)

Regards, 
Adi

Adrian

unread,
May 15, 2014, 5:36:09 AM5/15/14
to racti...@googlegroups.com
I've found the solution : the foreignObject child needs the namespace attribute. So this version works correctly : http://jsfiddle.net/YF9Te/1/
Thanks.

Rich Harris

unread,
May 15, 2014, 11:33:13 AM5/15/14
to racti...@googlegroups.com
Interesting - so the browser normally assumes that a foreignObject should have the html namespace, just like it assumes that an svg element should have the svg namespace. Ractive currently simulates the same behaviour for svg, but not for foreignObject. Have added an issue for this - https://github.com/ractivejs/ractive/issues/713. Thanks Adrian
Reply all
Reply to author
Forward
0 new messages