In trying to implement the Element.removeAttribute resp.
removeAttributeNS I am a little uncertain what happens with the
attribute node afterwards. Since it is a remove and not a delete
method it suggests that the attribute is still there. The problem of
the application is, how to find out its address (in order to entirely
delete it or to insert it somewhere else) since the removeAttribute
method does not return the removed node. So the application has to
detect the Attribute before removal:
MyAttr:= MyElement.getAttributeNode('xyz');
MyElement.removeAttribute('xyz');
deleteOrDoSomethingElse(MyAttr);
But then one could instead use the removeAttributeNode method:
MyAttr:= MyElement.getAttributeNode('xyz');
MyElement.removeAttributeNode(MyAttr);
deleteOrDoSomethingElse(MyAttr);
Conclusion: removeAttribute seems to be for almost every case
replaceable by removeAttributeNode. So its a superfluous extension of
the DOM unless it gets the removed node as its return value. Then one
could write:
MyAttr:= MyElement.removeAttribute('xyz');
deleteOrDoSomethingElse(MyAttr);
It's not backward compatible but elegant.
--
=====================================================================
Dieter Koehler, M. A. - dieter.koehler@ppp.uni-bamberg.de
Mittlere Kaulberg 22, D-96049 Bamberg, +49(0)951-5190726
"http://www.philo.de/Philosophie-Seiten/": 1000+ Philosophie-Links
"http://www.philo.de/VirtualLibrary/14.de.htm": Deutsche Philo-Links
"http://www.philo.de/xml/": Open XML - XML-Komponenten fuer Delphi
=====================================================================