transform as a presentation attribute [was: Re: [whatwg] SVG cloning elements from HTML5]

Hello world,

(sorry for not copying the whatwg mailing list, but I do not read that 
list, and so I am probably not able to write to that, neither) ...

Tab Atkins Jr. wrote:
> On Mon, Jun 23, 2014 at 9:35 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>> On Jun 24, 2014, at 5:25 AM, Robert O'Callahan <robert@ocallahan.org> wrote:
> 
>>> 4) Add a "transform" attribute to HTMLElement and have it map to the
>>> "transform" CSS property.
>> In this case we should think about making transform a presentation attribute in general for HTML and SVG.
> 
> That's effectively what it would do, yes.

Hey, that's a nice proposal - transform as a presentation attribute in 
SVG! Why? What would that mean? If your SVG objects are carefully placed 
and transformed in SVG via the transform attribute (e.g. in order to 
achieve a projection of a map on a globe, or to have specific objects 
displayed in specific sizes), this will be easily overridden by one 
simple CSS rule. Why? In 
[http://www.w3.org/TR/2008/REC-CSS2-20080411/cascade.html#q12], we read:
"The UA may choose to honor presentational hints from other sources than 
style sheets, for example the FONT element or the "align" attribute in 
HTML. If so, the non-CSS presentational hints must be translated to the 
corresponding CSS rules with specificity equal to zero. The rules are 
assumed to be at the start of the author style sheet and may be 
overridden by subsequent style sheet rules."
And in 
[http://www.w3.org/TR/2011/REC-CSS2-20110607/cascade.html#preshint], 
this is complemented by the following statement as well as an example:
"For other languages, all document language-based styling must be 
translated to the corresponding CSS and either enter the cascade at the 
user agent level or, as with HTML presentational hints, be treated as 
author level rules with a specificity of zero placed at the start of the 
author style sheet."

Great? Fabulous ;-)

Such a change would even be able to break existing content - ok, 
existing content would not be broken as long as nothing gets changed at 
all for the complete group of old files. But if in any referenced CSS 
stylesheet, a CSS rule with a rather general selector and a transform 
property gets added (to adopt the old content to new abilities, e.g. in 
order to move all elements slightly, or to increase their size a little 
bit, whatever reason might be possible), all the specific transform 
attributes in the old SVG code become useless.

That's a perfect opportunity to repeat my old proposal ("Precedence of 
CSS rules and presentation attributes in SVG" with "Date: Sat, 18 Jan 
2014 19:44:29 +0100"), or better to refine it:

Shouldn't the precedence rule mentioned in CSS be changed, so that (real 
and modern) presentation attributes (that refers to _all_ presentation 
attributes in SVG, at least) should be treated in the same way as a CSS 
rule added via style attribute to the object tag? "Real and modern" in 
the sense that <body bgcolor=black> (does anybody remember such ugly 
constructs from more than 15 years ago?) will not be affected, as we 
should not break existing content ... ;-)

Once again, any opinions?

Juergen Roethig

Received on Tuesday, 24 June 2014 08:38:27 UTC