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

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

From: Jon Ferraiolo <jferraio@Adobe.COM>
Date: Thu, 31 Aug 2000 10:03:12 -0700
Message-Id: <4.2.2.20000831100057.00b13340@mail-345>
To: Thierry Kormann <Thierry.Kormann@sophia.inria.fr>
Cc: www-svg@w3.org, Thierry.Kormann@sophia.inria.fr, Philippe.Le_Hegaret@sophia.inria.fr
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.

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated

At 03:50 PM 8/31/00 +0200, Thierry Kormann wrote:

>I would like to know why the SVG DOM is so complex to use? I mean that a 
>set of
>methods are already available in the DOM core API and the SVG DOM provides
>additional methods that are much more complicated to use.
>
>For example: A user want to set the width of its rectangle. He can do it 
>using
>two different approach. The first one is the most intuitive one. He knows the
>DOM API as it's the generic API for XML document so he can write:
>
>rect.setAttribute("width", "10cm");
>
>The second approach would be:
>
>1 - ask for the SVGAnimatedLength (as the width is animatable)
>2 - ask for the SVGLength using the getBaseVal method
>3 - change the value on it
>
>The question is "Do you think a svg user will prefer writing 3 lines of 
>code to
>change the width of its rectangle or just call one method he already knows?"
>I sure that 95% of the people that will script svg documents will choose 
>the one line solution (I will for example even if I know and implement the 
>SVG DOM).
>
>
>Well, I am not saying that the whole SVG DOM is obsolete. One possible 
>solution could be to remove all get/set methods (considering that people 
>can use the DOM core methods) and just keep the useful get methods 
>(without set) like getBBox, getCTM... Those methods could be a pain if 
>users have to implement them all the time.
>
>Hope to have some comments.
>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:03:52 GMT

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