Re: The discrepancy between SVG 'number' and CSS 'number'

On Mar 20, 2014, at 3:19 PM, Paul LeBeau <paul.lebeau@gmail.com> wrote:

> Hi
> 
> Has there been any prior discussion between this WG and the CSS WG about resolving the discrepancy between the definitions of the SVG and CSS number type?  The difference is that SVG number allows exponents and CSS doesn’t

That is no longer true. CSS Syntax allows exponents and Firefox implemented it already. IE had it in quirks mode for a very very long time. Not sure if it is also supported in strict mode.

> 

> This becomes an issue with style properties.
> 
> As an experiment, I tried the following test file on several renderers.
> 
> <svg width="400" height="400"  xmlns="http://www.w3.org/2000/svg">
> 
> <style>
> #one {
>   opacity: .5;
> }
> 
> #two {
>   opacity: 5E-1;
> }
> </style>
> 
>   <rect x="0" id="one" width="100" height="100" fill="red" opacity=".5"/>
>   <rect x="101" id="two" width="100" height="100" fill="red" opacity="5E-1"/>
> 
>   <rect x="0" y="101" id="one" width="100" height="100" fill="red"/>
>   <rect x="101" y="101" id="two" width="100" height="100" fill="red"/>
> 
>   <rect x="0" y="202" width="100" height="100" fill="red" style="opacity: .5" />
>   <rect x="101" y="202" width="100" height="100" fill="red" style="opacity: 5E-1" />
>     
> </svg>
> 
> 
> (The "0.5" test is in there because I was testing that for another reason.)
> 
> Anyway, I got varying results.
> 
>                                               Chrome33    FF28     IE11    Safari5.1   Batik1.7
> opacity=".5"             YES     YES   YES   YES     YES
> opacity="5E-1"           YES     YES   YES   NO(!)   NO
> CSS "opacity: .5"        YES     YES   YES   YES     NO(!)
> CSS "opacity: 5E-1"      NO      NO    YES   NO      ERROR
> style "opacity: .5"      YES     YES   YES   YES     YES
> style "opacity: 5E-1"    NO      NO    YES   NO      ERROR
> 
> 
> If in the future more attributes are to become properties, this discrepancy will need to be resolved, won't it?

Presentation attributes had to follow the SVG syntax while CSS definitions were following other conventions. That should be fixed in browsers eventually and exponents are allowed everywhere.

Greetings,
Dirk

> 
> Paul
> 
> 
> 
> 

Received on Thursday, 20 March 2014 14:32:19 UTC