[whatwg] Inline SVG

Leons Petrazickis leons.petrazickis at gmail.com
Fri Dec 8 12:20:37 PST 2006


On 12/8/06, Sam Ruby <rubys at intertwingly.net> wrote:
> Leons Petrazickis wrote:
> >
> > How about this for HTML5:
> > <object type="image/svg+xml">
> >    <svg version="1.1" xmlns="http://www.w3.org/2000/svg">
> >        <circle cx="100" cy="50" r="40" stroke="black"
> > stroke-width="2" fill="red"/>
> >    </svg>
> > </object>
> >
> > And this for XHTML5:
> > <object type="image/svg+xml">
> > <![CDATA[
> >    <svg version="1.1" xmlns="http://www.w3.org/2000/svg">
> >        <circle cx="100" cy="50" r="40" stroke="black"
> > stroke-width="2" fill="red"/>
> >    </svg>
> > ]]>
> > </object>
> >
> > If that's over-complicating the semantics of <object>, we could
> > introduce an inline <xml> tag that's similar to the inline <script>
> > and <style> tags. It would have a type="" attribute to specify the
> > mimetype, and its contents would be within a CDATA block in XHTML5.
>
> First, why the different syntax, and in particular, why CDATA?
>
> One of the key advantages of SVG, as it exists today, in XHTML is that
> the SVG elements are in the DOM.  Not as an opaque blob, but as a set of
> scriptable and stylable elements.  Take a look at the following:
>
> http://developer.mozilla.org/en/docs/SVG_In_HTML_Introduction

I was thinking more of HTML5. XHTML5 was an afterthought.

The basic idea is that HTML5 is not an XML or SGML format. We may want
inline SVG and other XML-based formats, but we don't want to define
exceptional parsing rules for such. Such rules are already defined
elsewhere, just as with Javascript and CSS.

So, we provide a tag -- <inline-xml
type="image/svg+xml">....</inline-xml> -- that lets people embed XML
data. What's inside is skipped over by the HTML5 parser. Browsers may
implement support for any such XML format. If they do, they may insert
the tag's contents in the DOM in place of the <inline-xml> tag.

<http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2006-December/008444.html>

Unlike Michel Fortin's proposal for <script
type="image/svg+xml"></script>, I suggest that SVG included like this
be rendered as an image in that exact spot. We may want to define a
default height and width for all <inline-xml>...</inline-xml> content.

This gives us inline SVG, and provides room for other inline XML
formats down the road.

Regards,
--
Leons Petrazickis



More information about the whatwg mailing list