W3C home > Mailing lists > Public > www-svg@w3.org > September 2008

Re: baseVal / animVal clarfication (sorry if this comes in twice)

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 5 Sep 2008 10:18:41 +1000
To: www-svg <www-svg@w3.org>
Message-ID: <20080905001840.GA28564@arc.mcc.id.au>

Sigurd Lerstad:
> I'm trying to figure out if animVal returns the same object as baseVal if 
> the property is not being animated. Batik and Opera return different objects 
> even if the property is not being animated.

I think the spec is unclear.  When it says “If the given attribute or
property is not currently being animated, contains the same value as
'baseVal'” it could be talking about the animVal IDL attribute
containing the same value as baseVal, or it could be saying that the
animVal SVGLength object contains the same length value as the SVGLength
object stored in baseVal.

> "If the given attribute or property is not currently being animated, 
> contains a readonly object with the same contents as 'baseVal'. "

I don’t have a strong opinion either way, but I think it may be slightly
more useful for authors to have animVal specifically return an object
different from baseVal, so you could do this kind of thing:

  <circle id='r' r='100'>
    <animate attributeName='r' to='200' dur='5s' begin='click'/>
  <text id='t'/>
    t = document.getElementById('t');
    r = document.getElementById('c').r.animVal;
    setInterval(function() { t.textContent = r.value }, 500);

I.e., remember the SVGLength object without worrying about whether
animations are active or not currently.  OTOH, requiring the two
attributes to return the same value when animations are not active would
provide a way for authors to detect from script whether an animation was
being applied to an SVGAnimatedLength.  (But not for SVGAnimatedString
or some other primitive types.)

Cameron McCormack ≝ http://mcc.id.au/
Received on Friday, 5 September 2008 00:19:39 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:15 UTC