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

Why the SVG DOM is so complex to use?

From: Thierry Kormann <Thierry.Kormann@sophia.inria.fr>
Date: Thu, 31 Aug 2000 15:50:19 +0200
Message-Id: <200008311350.e7VDoJb09899@quokka.inria.fr>
To: www-svg@w3.org
cc: Thierry.Kormann@sophia.inria.fr, Philippe.Le_Hegaret@sophia.inria.fr

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 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 09:50:26 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:49 UTC