W3C home > Mailing lists > Public > www-svg@w3.org > October 2000

Attribute and SVG object synchronization.

From: Blaine Brodie <bbrodie@savagesoftware.com>
Date: Thu, 26 Oct 2000 09:09:26 -0700
Message-id: <fc.0085846d00016fb80085846d00016fb8.170da@savagesoftware.com>
To: www-svg@w3.org
The current SVG specification does not mention this, but I assume that an
SVGElement's attributes must be synchronized with their corresponding SVG
objects.  For example, an SVGCircleElement's 'cx' attribute must be
synchronized with its 'cx' SVGAnimatedLength object.  So, if I perform the
following calls on SVGCircleElement named 'circle':
  circle.setAttribute("cx", "100");
  circle.getCx().getBaseVal().setValue(50);

then circle.getAttribute("cx") should return '50'.  Right?

This leads me into another question regarding outstanding references to
SVG objects.  What is expected to happen to these references when the
attribute's string value becomes updated.  Do these objects simply get
detached from their parent elements or do they get updated with new
values?  Here's an example:

  circle.setAttribute("cx", "50");
  SVGLength length = circle.getCx().getBaseVal(); //got a reference
  length.getValue(); //returns 50

  circle.setAttribute("cx", "100"); //set the 'cx' attribute.  Is the
outstanding 'length' reference updated or detached from its parent element?
  length.getValue(); //returns '50' or '100'?

If the objects simply get detached, then the last call would return '50'. 
If outstanding references are updated then the last call would return
'100'.
Thanks for the clarification.
---
Blaine
Received on Thursday, 26 October 2000 12:11:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:48 GMT