Re: transform as a presentation attribute

Hello Juergen,

Thursday, June 26, 2014, 9:39:36 AM, you wrote:

> Hello world,

> Am 24.06.2014 23:44, schrieb Tab Atkins Jr.:
>> [...]
>>
>> <!DOCTYPE html>
>> <svg viewBox="0 0 10 10" width=100 height=100 style="border: thin solid;">
>>   <rect x=1 y=1 width=2   height=2   fill=blue ></rect>
>>   <rect x=1 y=5 width=2px height=2px fill=green></rect>
>> </svg>
>>
>> [...]

> Just a question: Is this really the way we should code SVG in the 
> future, or even in the present?

Its how you should code html with inline svg. Well, mostly; in general
the width and height attributes should not be used except for
- non-scalable vector graphics
- tests (like Tab's example)

>  As in the past, it looked somewhat
> different (DOCTYPE, attributes, ...) ... especially the <!DOCTYPE html>
> concernes me somehow.

The DOCTYPE html says that it is an html document. The svg element
says that this html document has inline svg (and in this example, no
other content).

If you are coding standalone SVG then you don't need a doctype at all.
See the examples in SVG 1.1 section 5.1.1

<svg xmlns="http://www.w3.org/2000/svg" …>
  <rect …/>
</svg>

http://www.w3.org/TR/SVG11/struct.html#NewDocumentOverview

However, you are then using an xml parser not an html5 parser so
- declare the svg and (if used) xlink namespaces
- use well formed markup (so closing open elements, quoting all
attributes).

So the test case Tab gave, as a standalone svg file:

<svg viewBox="0 0 10 10" width="100" height="100"
  style="border: thin solid;" xmlns="http://www.w3.org/2000/svg">
 <rect x="1" y="1" width="2"   height="2"   fill="blue"/>
 <rect x="1" y="5" width="2px" height="2px" fill="green"/>
</svg>

For the purposes of a test used to illustrate a point in email, the
version Tab gave is shorter to type (and will work in a browser that
has an html5 parser and does inline svg in html, i.e. all of them
now). So will the standalone version.




-- 
Best regards,
 Chris                            mailto:chris@w3.org

Received on Thursday, 26 June 2014 12:55:56 UTC