W3C home > Mailing lists > Public > public-fx@w3.org > April to June 2012

[css3-transforms] 7.2. Syntax of the SVG ‘transform’ attribute

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Sat, 21 Apr 2012 15:29:13 +0100
To: www-style@w3.org, public-fx@w3.org
Message-Id: <201204211629.13408.Dr.O.Hoffmann@gmx.de>
Hello,

this is about 
http://www.w3.org/TR/2012/WD-css3-transforms-20120403/#svg-syntax

It notes:
[To provide backwards compatibility, the syntax of the ‘transform’ 
presentation attribute differs from the syntax of the ‘transform’ style 
property as shown in the example above. However, the syntax used for 
the ‘transform’ style property can be used for a ‘transform’ presentation 
attribute value. Authors are advised to follow the rules of CSS Values and 
Units Module. Therefore an author should write ‘transform="translate(200px, 
200px)"’ instead of ‘transform="translate (200 200)"’ because the second 
example with the spaces before the ‘(’, the missing comma between the 
arguments and the values without the explicit unit notation would be valid 
for the attribute only.]

Because in SVG 1.1 and SVG tiny 1.2 all numeric values for transform
are numbers, it is obviously for backwards compatibility a bad idea to
add any units, because this will/should not work in proper older/curent
viewers.
And typically it is widely recommended best practice for SVG anyway to 
use no units at all within the content to avoid confusion and problems.

Therefore I suggest to change this section to something like this:
 [To provide backwards compatibility, the syntax for the ‘transform’ 
presentation attribute and the syntax for the ‘transform’ style property
differ from each other as shown in the example above. 
However, the syntax used for the ‘transform’ style property can be used 
for a ‘transform’ presentation attribute value, if backwards compatibility 
does not matter. 

Authors are recommended to avoid any units for the transform
attribute, if backwards compatibility matters. To be on the safe side an
author should write ‘transform="translate(200, 200)"’ instead 
of ‘transform="translate(200px, 200px)"’ or ‘transform="translate (200 
200)"’, because the third example with the spaces before the ‘(’, the missing 
comma between the arguments and the values without the explicit unit notation 
would be valid for the attribute only. The second example with units however 
does not fit to the definition of transform in previous SVG recommendations 
and should be avoided for backward compatibility.
Note that for the attribute scientic notation is available as well:
‘transform="translate(1e6, 3e5)"’. ]

Additionally one could add the precise Backus-Naur Form (BNF)
to decribe precisely, what is correct for the attribute.


Best wishes

Olaf
Received on Saturday, 21 April 2012 14:29:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 21 April 2012 14:29:44 GMT