Re: [css21][css3][svg] SVG and unit-less length values

On Wednesday, July 7, 2010, 5:02:00 PM, Sylvain wrote:

>> From: Boris Zbarsky [mailto:bzbarsky@MIT.EDU]
>> > [3]

>> As the text at this link clearly says:

>>    For properties defined in CSS2 [CSS2], a length unit identifier
>>    must be provided. For length values in SVG-specific properties
>>    and their corresponding presentation attributes, the length unit
>>    identifier is optional.

>> Now this leaves a loophole the size of a truck for properties not in
>> CSS2 but presend in CSS2.1 or CSS3...  But that's pretty easy to fix.

Agree about the loophole, not desirable (but hard to normatively link to all future CSS specs, too. Besides, CSS might in future define some properties with optional units).

The easy fix being s/CSS2 [CSS2]/CSS/ ? or some other fix?

SG> Pretty easy is good. Let's just say bringing up this issue internally
SG> and externally has caused much surprise and some level of dismay. Authors,
SG> in particular, find this confusing. 

I agree that authors and implementors find this confusing.

If they are more used to HTML/CSS then they expect to use units everywhere, and may take a while to 'get' the concept of world coordinates and local coordinates.

If they are more used to SVG (or some other vector format) and they are starting to apply that to HTML/CSS then they are surprised to find they need to add units 'even if it doesn't make sense'.

Also, historically, some implementations did not require units, even when the property was used in a stylesheet.

SG> My main goal here is to try and reduce
SG> that surprise. I also would like to be very clear on where this exception
SG> applies; I don't think the prose above is quite there i.e. does SVG-specific
SG> mean an SVG property applying to an SVG node so that it would be ignored and
SG> thus wouldn't show in the OM of a non-SVG node ?

No, because properties defined in SVG can be and indeed are, in existing implementations, applied to HTML as well. An obvious example (although this does not take a length) is the filter property. So 'defined in SVG spec and applying to an element in the SVG namespace' is not the intention. Perhaps 'SVG specific' is over constraining or misleading, here.

>>  > The CSSWG must of course keep this in mind when defining new
>>  > properties that are intended to apply to SVG documents.

>> Only insofar as we need to avoid name collisions with existing
>> properties that the SVG specification defines and which it therefore
>> requires to have the unitless length behavior, no?

SG> Not just that. If a CSS3 or 4 module defines a new feature that is
SG> intended to also apply to SVG documents - e.g. transitions - it must make
SG> sure to not use the line-height or columns property pattern where both
SG> numbers and lengths can be set as value.


 Chris Lilley          
 Technical Director, Interaction Domain
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG

Received on Wednesday, 7 July 2010 15:18:05 UTC