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

Hello, Juergen,

I am not entirely sure what you try to suggest. I just try to reply to some of your proposals/questions.

On Jun 24, 2014, at 10:37 AM, Juergen Roethig <roethig@dhbw-karlsruhe.de> wrote:

> 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?

This is not a proposal anymore. It is already specced for SVG elements and partly implemented in WebKit, Blink and Firefox. The relevant spec is CSS Transforms[1]. The discussion here is about extending it to all HTMLElements as well. It seems unlikely that content uses the ’transform’ attribute in HTML today.

> 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 ... ;-)

I am not entirely sure what your proposal is and the descriptions above are hard to keep apart. In general, SVG specifies presentation attributes as an author stylesheet with a higher precedence than the UA style sheets but lower precedence than any other author style sheets and especially inline style. I tried to illustrate the precedence in an article some time ago[2]. HTML has presentation attributes as well IIRC and at least WebKit/Blink implements them the same way.

To summarize: The behavior of presentation attributes in the styling cascade is specified in SVG and is already implemented this way by all browsers with SVG support.

Greetings,
Dirk

[1] http://dev.w3.org/csswg/css-transforms/
[2] http://blogs.adobe.com/webplatform/2013/01/08/svg-styling/

Received on Tuesday, 24 June 2014 09:11:10 UTC