W3C home > Mailing lists > Public > www-svg@w3.org > July 2009

Re: Detecting SVG-in-HTML capabilities

From: Geoffrey Sneddon <gsneddon@opera.com>
Date: Thu, 23 Jul 2009 11:21:28 +0200
Message-ID: <4A682B98.6040904@opera.com>
To: Jeff Schiller <codedread@gmail.com>
CC: HTML WG <public-html@w3.org>, www-svg <www-svg@w3.org>
Jeff Schiller wrote:
> Most browsers support inline SVG in XHTML (application/xhtml+xml).  No
> browsers natively support SVG-in-HTML (text/html) though Firefox
> sounds like it is getting closer.
> 
> Should there be a feature string defined in HTML5 for this capability
> (i.e. specifically for supporting SVG-in-HTML-syntax) for use with
> hasFeature [1]?  I'm concerned about fallback scenarios and for
> preventing extra work for some libraries [2].
> 
> Regards,
> Jeff
> 
> [1] http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-5CED94D7
> [2] http://berjon.com/hacks/force-svg/


I'm not sure we want to advocate use of hasFeature, as it seems better 
to check for capability rather than some claim to support.

Given an HTML-with-SVG document, you could just:

var svg = document.getElementsByTagName("svg")[0];
var supported = svg.namespaceURI == "http://www.w3.org/2000/svg";

-- 
Geoffrey Sneddon  Opera Software ASA
<http://gsnedders.com/>
<http://www.opera.com/>
Received on Thursday, 23 July 2009 09:22:15 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:42 GMT