Subject: | SVG instance does not represent svg root element |
I think it should be mentioned in the docu that an SVG instance
represents the document and not the <svg> root element. For example if
you create an object
$svg = SVG->new(width => 100);
then $svg->getAttribute('width') will not give you your 100, but undef.
Instead, you will get the 100 for example with
$svg->firstChild->getAttribute('width');
It would be nice to have an explicit method that returns the root
element, e.g. $svg->root. However, if the behaviour described above will
not change in the future then the firstChild approach is fine.
Additionally, it would be good to have a documented way to tell if an
element - for example given to a subroutine - is a document or an SVG
element, for example representing a subtree.
Right now, this could be tested by
$node->isa('SVG')
or by
$node->getNodeName eq 'document'
However, as I said, it would be nice to have a documented way to do this
which will be stable across future versions.
Thanks for your great work on SVG,
Lutz