Reputation: 734
Any SVG elements within a foreignObject will not be drawn, except in the situation where a properly defined SVG subdocument with a proper xmlns attribute specification is embedded recursively.
I've tried setting the proper namespaces to all subsequent elements without any succes.
What i'm trying to accomplish is roughly this:
<svg>
<foreignObject>
some html text
<svg width="10" height="10"><rect fill="red" width="10" height="10" /></svg>
</foreignObject>
</svg>
Upvotes: 4
Views: 2884
Reputation: 124169
You must have a single element inside the foreignObject, although that element may have children. So you can do this...
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<foreignObject width="100%" height="100%">
<div xmlns="http://www.w3.org/1999/xhtml">some html text
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><rect fill="red" width="10" height="10" /></svg>
</div>
</foreignObject>
</svg>
Upvotes: 5