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

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'/>
  </circle>
  <text id='t'/>
  <script>
    t = document.getElementById('t');
    r = document.getElementById('c').r.animVal;
    setInterval(function() { t.textContent = r.value }, 500);
  </script>

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