On Sat, 2008-03-15 at 17:34 -0300, Hannes Hochreiner wrote:
Before working on further features, I wanted to create an Inkscape extension to provide a convenient way for people to add the necessary JavaScript to the SVG image and have an "onload"-attribute added to the root node to load the initialisation function when the image is loaded into a browser. Writing a small C++ programme to add the script was straight forward. The only problem I am experiencing is that the required "onload"-attribute of the root node is not copied into the SVG file Inkscape uses after the extension exits. Having a quick look at the source code, it seems to me that only the "width" and "height" attributes are copied.
I am curious why it was decided not to copy the other attributes of the root node from the SVG files that are returned form extensions. I think it would be a neat thing to do, but there might be good reasons why this is not a good idea. Furthermore, I would like to ask, if there is another way to add attributes to the root node using an extension.
To keep things sane would couldn't just delete the root node and reload it, that would have confused many other parts of Inkscape, so we were just doing attributes. The choice of attributes was arbitrary. I think that we could just copy anything that is in a non-svg namespace. But, then also things like onload and others.
Also, there is a bug in Launchpad that I don't believe that has been fixed where doing path operations causes extra data to be lost on paths and other objects. If you're using extensions to add data, you might run into that one. I know that the BMX biking level editor did.
--Ted