W3C home > Mailing lists > Public > www-svg@w3.org > March 2014

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

From: Paul LeBeau <paul.lebeau@gmail.com>
Date: Fri, 21 Mar 2014 03:19:45 +1300
Message-ID: <CACfsppAJCvr8uy0LFeE9w_BMiA7+gK7MXonOZrLZKQKerqn4Kw@mail.gmail.com>
To: www-svg <www-svg@w3.org>
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.

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?

Paul
Received on Thursday, 20 March 2014 14:20:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:51 UTC