intertwingly

It’s just data

SVG in HTML Momentum Building


Lots of interesting discussion about SVG in browsers.  Here’s a roundup of my favorites, along with my thoughts:

But all in all, momentum is building towards supporting SVG in HTML5, and that makes me happy.  It is clear that whatever form it takes won’t satisfy everybody.  I’d still prefer that HTML5 support distributed extensibility, but meanwhile, let me toss out the following; merely in the spirit of brainstorming:

<!doctype html>
<title>SVG in text/html</title>
<p>
 A green circle:
 <script type="image/svg+xml"> <circle r="50" cx="50" cy="50" fill="green"/> </script>
</p>

As I said, no solution will satisfy everybody, and the above clearly won’t support nested scripts.  It also requires copy/pasters to skip over the XML prolog, DOCType, and perhaps even the outermost <svg> tag itself.  None of these issues need apply to <script src="…"></script>.  Ideally, the end result of such a “script” would be nearly indistinguishable from the DOM nodes that standards-compliant browsers produce for inline SVG in XHTML today.

Update: Michael Day suggests <style> instead. If the HTML5 working group will agree to stop hoisting such elements into the <head> section of the DOM, that would work too.