[whatwg] Inline SVG

Michel Fortin michel.fortin at michelf.com
Sat Dec 9 05:54:29 PST 2006

Le 9 déc. 2006 à 7:32, Martin Atkins a écrit :

> Using <script> has the ultimate advantage that existing browsers  
> will *already* ignore it, while for some new element legacy  
> browsers will attempt to parse the contents as HTML and may end up  
> displaying something unintended. It's unclear how you'd implement  
> fallback behavior for <script type="application/xml">, though,  
> since the only fallback for <script> is <noscript>, which is  
> ignored if the browser supports scripting of any kind, regardless  
> of type.

You'd need a JavaScript fallback in addition to noscript, something  
like this:

<script type="text/xml" id="a">
<noscript id="b">
   fallback content
<script type="text/javascript">
   if (/* browser does not support XML scripts */) {
     if (/* has some javascript XML parser library */) {
     } else {

It could also be an external script that justs search the document  
for a particular class of <noscript> element once the document is  

> This also raises an interesting question about how you'd embed an  
> XML application that itself features a <script> element, since any  
> </script> ends the parsing of the script element regardless of  
> nesting. (The HTML parser just sees the XML as an opaque block of  
> text.)

You'd have to play with namespace prefixes:

<script type="text/xml">
   <my:script my:xmlns="...">

Not the a very elegant solution however, and not very copy-paste  

Michel Fortin
michel.fortin at michelf.com

More information about the whatwg mailing list