Re: SVG in HTML proposal

On 7/15/08, Doug Schepers <> wrote:
>  2) If my SVG has a foreignObject with HTML in it, and the browser does not
>> handle SVG yet, then the contents of that foreignObject will be
>> inadvertently rendered by the UA, which might not be desired.  Any
>> recommendation for that?   html: prefix for all elements?
> This is one reason that I initially suggested the <ext> element [1], so
> that any UA which does not understand SVG but does support <ext>/<fallback>
> (which would be trivial to implement) could not only hide any such
> extraneous code, but also render a fallback (and it would work for any
> non-HTML language, not just SVG, so you could have a fallback for MathML,
> etc.).  We'll have to see if there is support for that particular bit.

But IE7- understands neither SVG nor <ext>.  I assume it it doesn't
understand CSS Namespaces either (in which case we can't use Erik's
suggestion).  There are hacks to add unknown elements in IE though [1], so
with script and IE-specific stylesheets you could work around - for users
who have enabled scripting.

On 7/15/08, Erik Dahlström <> wrote:

> Having <svg:a> be interpreted by a legacy user agent as <html:a> is perhaps
> not that critical, you can even add a 'src' attribute to have the link work
> in both contexts, so it can be used as a sort of fallback.

I assume you mean a 'href' attribute to the link ;)  I use this very hack on
my blog comments, actually [2].  However, in my case it was intentional and
I was very cognizant of it.  I can't say the same for other authors who want
to just copy and paste SVG fragments into HTML documents and see it work.

Another semi-problem is that text nodes within SVG fragments will be
rendered by IE.  This is a problem with any solution of SVG-in-HTML, not
just the SVG WG proposal and I guess in that case we need to use the
document.createElement() hack to avoid it?

I guess the reality is that for the one non-SVG browser vendor out there
we're always going to have problems with any SVG-in-HTML solution and it
will just come down to arming web authors with the knowledge to work around
that browser's lack of support until such day that...



Received on Tuesday, 15 July 2008 12:53:50 UTC