[whatwg] Inline SVG
Sam Ruby
rubys at intertwingly.net
Fri Dec 8 09:00:26 PST 2006
Leons Petrazickis wrote:
> On 12/7/06, Alexey Feldgendler <alexey at feldgendler.ru> wrote:
>> On Mon, 04 Dec 2006 13:55:32 +0600, Ian Hickson <ian at hixie.ch> wrote:
>>
>> >> http://intertwingly.net/stories/2006/12/02/whatwg.logo
>>
>> > Currently, there wouldn't be one. We could extend HTML5 to have some
>> sort
>> > of way of doing this, in the future. (It isn't clear to me that we'd
>> want
>> > to allow inline SVG, though. It's an external embedded resource, not a
>> > semantically-rich part of the document, IMHO.)
>>
>> People will do inline SVG anyway. If there won't be a straightforward
>> way to do this, authors will use all kinds of dirty hacks, such as
>> data: URIs and DOM manipulation.
>>
>> Personally, I don't think SVG content is inappropriate for HTML
>> documents. It is no more presentational than the text itself: HTML
>> doesn't try to structure natural language sentences by breaking them
>> into grammar constructs, so an SVG image could be thought of as just
>> an atomic "phrase" which only has defined semantics as whole.
>
> 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
- Sam Ruby
More information about the whatwg
mailing list