Re: Why the SVG DOM is so complex to use?

Jon,

> The main reason for the having attributes in the DOM such as 'width' and 
> 'height' are so that you can have object-oriented access to the values, 
> rather than just as strings. Yes, in many cases, string access is 
> sufficient, but in other cases, there is a lot of value in object-oriented 
> access. For example, with an SVGLength, you can determine what unit type 
> was applied without having to write a parser.

I have also another comment.

By writting my example, I was just thinking on "how people will use the SVG DOM 
API". In fact, developers don't (and don't even want to) know what the viewer 
has to perform when the setAttribute or the setValue method is called. They 
will just would like to know "What's the easiest way to do what I want" and 
really think that the setAttribute is the good answer.

As far as the performance is concerned, I am really not sure that parsing 10cm 
is  slower that creating a SVGLength plus an AnimatedSVGLength and invoking 
methods of those objects. In memory I am sure that the String version is much 
smaller than the object-oriented version.

If you want to provide a lot of value (2 at the moment), you can imagine 2 
attributes (more can be added in SVG 2 without changing the API) such:

getAttribute("width");
getAttribute("animated-width");

May be, namespaces can be used : svg:width and animatedSvg:width to specify the 
attribute.

Thierry.

-- 
Thierry Kormann
email: Thierry.Kormann@sophia.inria.fr  http://www.inria.fr/koala/tkormann/
Koala/Dyade/Bull @ INRIA - Sophia Antipolis

Received on Thursday, 31 August 2000 13:41:53 UTC