RE: Proposal for unitless lengths (Was: Is the px unit equivalent to user units?)

On Thu, 5 Jan 2006, Doug Schepers wrote:
>
> I suggest that to resolve this issue, we should apply the same logic 
> that Dean suggested in resolving the issue with units. The application 
> of the value for unitlesss <number>s to unitful <length>s would seem to 
> require an explicit "casting" of the attribute value, so similarly, we 
> should require the casting of a scientific notation in any offending 
> style attribute to the equivalent decimal representation in the computed 
> property. However, this should not affect the attribute value literal 
> itself.

You are confusing two things.

The _syntax_ being different is a problem for people writing _parsers_. It 
has absolutely no effect whatsoever on the strongly typed value that is 
used in the cascade, computation, inheritance, used-value-calculation, and 
actual-value-calculation steps.

Take 'color' for instance. All of the following:

   color: red;
   color: RED;
   color: #f00;
   color: #FF0000;
   color: rgb(255,0,0);
   color: rgb(100%, 0%, 0%);

...have EXACTLY THE SAME internal representation. They are all EXACTLY the 
same specified value, computed value, cascade value, inherited value, used 
value, etc. You don't have to "convert" the keyword 'red' to the hex value 
"#FF0000"; it's the same thing. The only difference is the syntax that the 
parser has to support.


The only problem with having SVG attributes use a different syntax than 
text/css is that you need a different parser. There are plenty of 
differences in the syntax:

 * Numbers can have "e" notation in SVG, not in CSS.
 * Lengths can omit the "px" unit specifier in SVG, not in CSS.
 * Keywords are case-sensitive in SVG, not in CSS.
 * Values in lists can have CSS comments between them in CSS, not in SVG.
 * etc.

We are already way past the paint of being able to trivially re-use the 
same parser for both.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 6 January 2006 01:58:01 UTC