W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: Scientific notation in numbers

From: Erik Dahlstrom <ed@opera.com>
Date: Tue, 16 Feb 2010 16:51:29 +0100
To: "Boris Zbarsky" <bzbarsky@mit.edu>, "Zack Weinberg" <zweinberg@mozilla.com>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.u778zwpxgeuyw5@localhost>
On Wed, 10 Feb 2010 23:50:30 +0100, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 2/10/10 4:27 PM, Zack Weinberg wrote:
>> That means what I said to Chris Lilley about the style-attribute spec
>> is wrong.  And now I'm wondering where the SVG spec *expects* scientific
>> notation to work.
> http://www.w3.org/TR/SVG/types.html#BasicDataTypes says for <number>:
>   <number> (real number value): The specification of real number
>   values is different for property values than for XML attribute values.
>    * CSS2 [CSS2] states that a property  value which is a <number>
>      is specified in decimal notation (i.e., a <decimal-number>), which
>      consists of either an <integer>, or an optional sign character
>      followed by zero or more digits followed by a dot (.) followed by
>      one or more digits. Thus, for conformance with CSS2, any property
>      in SVG which accepts <number> values is specified in decimal
>      notation only.
>    * For SVG's XML attributes, to provide as much scalability in numeric
>      values as possible, real number values can be provided either in
>      decimal notation or in scientific notation (i.e., a
>      <scientific-number>), which consists of a <decimal-number>
>      immediately followed by the letter "e" or "E" immediately followed
>      by an <integer>.
> Thus an implementation of SVG 1.1 would be expected to parse scientific  
> notation only in the XML attribute values.  Then <length> is defined in  
> terms of <number> and explicitly points to the above distinction.
> This does mean that you can do:
>    <rect id="foo" width="1e3"/>
> but can't do:
>    <style>#foo { width: 1e3; }</style>
>    <rect id="foo"/>
> and need to use "width: 1000;" instead.

Right, though that example would still not work since 'width' is only an  
attribute in SVG 1.1, not a property.

But if you replaced 'width' with for example 'stroke-dashoffset' that  
would behave like you described here.


Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Tuesday, 16 February 2010 15:46:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:43 UTC