W3C home > Mailing lists > Public > www-svg@w3.org > May 2012

Re: using CSS syntax for presentation attributes

From: Dirk Schulze <dschulze@adobe.com>
Date: Wed, 23 May 2012 13:34:32 -0700
To: Bjoern Hoehrmann <derhoermi@gmx.net>
CC: Cameron McCormack <cam@mcc.id.au>, SVG public list <www-svg@w3.org>
Message-ID: <6A7B953D-94BE-4245-B365-9725BE360C17@adobe.com>
On May 23, 2012, at 1:00 PM, Bjoern Hoehrmann wrote:

> * Dirk Schulze wrote:
>> I would rather limit the differences instead of increasing them. Like
>> discussed before, browsers already use the CSS parser for presentation
>> attributes but with special casing on presentation attributes. Instead
>> we should support Tab's idea to support scientific notations and unit
>> less values in CSS in general, so that we don't need to special casing
>> anymore. How could comments in presentation attribute increase
>> readability? Why no comment in or before the element?
> 
> I'm not aware that anyone is arguing comments in presentation attributes
> would increase readability, but they would have to be allowed in order
> to align the syntaxes as CSS allows comments for instance in functional
> notations like rgb(/**/0,0,0), which has not been very necessary in the
> past, but will probably see increased usage as CSS adds new constructs
> that are composed of many characters, like gradients and image sets and
> border images and multiple background images or whatever. Authors of SVG
> content might prefer comments outside attributes, because making presen-
> tation attributes "very long" is a problem on its own, but that does not
> affect whether they would be allowed and parsed in presentation attri-
> butes.

That is an interesting point. I never thought about adding comments to a presentation attribute from the CSS syntax point of view. I just tested the following:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect width="100" height="100" fill="/*Test*/green/*Test*/"/>
</svg>

This is green in WebKit based browsers. But in WebKit we really just special case unit less values and (shortly) scientific numbers. Everything else gets parsed like every CSS input. Surprisingly other browsers spend more efforts to parse it and follow the SVG syntax. The rect is black in Opera, Firefox and IE but green on Batik and WebKit.

Actually the proposal would increase interoperability between CSS and SVG on using CSS comments. I misunderstood the proposal from Cameron. I am sorry Cameron.

On May 23, 2012, at 1:11 PM, Bjoern Hoehrmann wrote:

> * Cameron McCormack wrote:
>> I just mentioned in 
>> http://lists.w3.org/Archives/Public/www-style/2012May/0830.html that 
>> implementations (unsurprisingly) differ in whether they accept CSS-style 
>> comments and escapes in presentation attributes.  In the spirit of 
>> reducing the differences between values in presentation attributes and 
>> style sheet declarations (and remember that we have already agreed to 
>> remove the case sensitivity of them), what do people think about 
>> allowing comments and escapes in presentation attributes?
> 
> Given that we've been discussing this issue for over a decade, and the
> rather firm decision by one of the former SVG Working Groups that they
> would rather roll their own syntax for everything than adopt the weird
> CSS syntax that allows comments and escapes and other things in odd
> places, it would be helpful if someone could dig out the minutes where
> that decision was made, to avoid re-hashing the arguments made back then
> if nothing else. They are probably member-only, but that should be no
> problem for members…
I assume the reason is that some viewers did not support CSS and the SVG WG wanted to avoid to specify the CSS syntax again. But I might be wrong. This could somehow be related to Cameron's proposal to require CSS support for SVG 2 in general.

However, as far as I understood, we already decided during out F2F to follow CSS syntax as far as possible. Therefore we should just reference CSS syntax (/ units and values) on SVG 2 and leave the decision for comments to these specs. That might allow comments or not.

Greetings,
Dirk

> -- 
> Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
> Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
> 25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
> 
Received on Wednesday, 23 May 2012 20:34:50 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:51 GMT