[css4-values] basic data types in SVG (was: [css3-syntax] stroke-dasharray unit less values)

(12/06/10 8:51), Cameron McCormack wrote:
> Dirk Schulze:
>> This example uses a dash array with unit less values for the inline
>> style. According to the current CSS rules, it should be invalid but
>> works on all UAs. Looking at the source code of WebKit, the following
>> further properties have the same behavior 'kerning' (removed from
>> SVG2) and 'baseline-shift'. Does the CSS3 Syntax take this into
>> account already? Is it possible to allow <number> for these
>> properties as well, to specify the current behavior of UAs (might be
>> against the rules according to CSS2.1 as well)?
> 
> I think we should just add <number> to the definition of
> stroke-dasharray.  We will be defining in SVG 2 which presentation
> attributes have the "<length>s can be specified as unitless numbers"
> behaviour, and stroke-dasharray then would be one that opts out of this.

Just a side discovery since 'stroke-dasharray' was mentioned: the
grammar of <dash-array> is

  dasharray ::= (length | percentage) (comma-wsp dasharray)?

and comma-wsp is

  comma-wsp  ::= (wsp+ ","? wsp*) | ("," wsp*)
  wsp        ::= (#x20 | #x9 | #xD | #xA)

.

There are two problems here

1. A space or "," is required to separate two tokens. Chrome, Firefox
and Opera are not following this as far as I can tell

(Tested with

data:text/xml,<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"><rect x="100" y="100"
width="100" height="100"
style="stroke:black;fill:none;stroke-dasharray:2px/**/2px;"/></svg>

, where CSS comment is used in place of a space.)

IE9 treats this as invalid and drops it, but it also treats
'stroke-dasharray: 2/**/2' as 'stroke-dasharray: 22' so it's not
conforming either. (IE seems to remove CSS comment in the preprocessing
step.)

2. Unlike CSS2.1, wsp doesn't include form feeds, i.e. #xC. I think
that's because XML doesn't allow form feeds. But #xC will appear in
SVG-in-HTML and browsers support this.

(Tested with

data:text/html,<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">   <rect x="100" y="100"
width="100" height="100"
style="stroke:black;fill:none;stroke-dasharray:2px%0C2px;"/></svg>
)


I think it might be nice to move this whole "Basic Data Types" section
into css4-values so some of these quirky test cases can have a common home.


Cheers,
Kenny

Received on Sunday, 10 June 2012 02:15:48 UTC