Re: SVGStopElement offset

Hej Niklas,

On Wed, 03 Jul 2002, Niklas Gustavsson wrote:

> I've been looking into the SVGStopElement in the SVG 1.0/1.1 DOM and got a
> question.
> 
> The offset attribute can hold either a number or a percentage, but in the
> DOM interface the offset can only hold a animated number. How am I supposed
> to save/get the percentage value?

Maybe I'm misunderstanding your question, but you could always
use getAttribute to see exactly how it was set in the 
document (percentage or number).

However, if you want the animated value, then you have to use
the SVG DOM, thus animated number (which only gives you a float).

Checking Chapter 4, we have the following:

  Within the SVG DOM, a <number> is represented as a float or an
  SVGAnimatedNumber.

  Within the SVG DOM, a <percentage> is usually represented as an
  SVGLength or an SVGAnimatedLength.

Looks like you'll have to multiply by 100 to get the percentage 
value through the SVG DOM. We'll quickly check this within the
WG since it seems a little weird, but I don't think there is
much we can do with it (i.e. we couldn't make it an SVGLength).
By the way, we're about to carefully check all the <percentage>
and <length> attributes in the SVG specification (for another
reason).

Dean

Received on Wednesday, 3 July 2002 21:23:38 UTC