Rename an existing node of type
When possible this simply changes the name of the given node, otherwise
this creates a new node with the specified name and replaces the existing
node with the new node as described below.
If simply changing the name of the given node is not possible, the following
operations are performed: a new node is created, any registered event
listener is registered on the new node, any user data attached to the old
node is removed from that node, the old node is removed from its parent
if it has one, the children are moved to the new node, if the renamed node
Element its attributes are moved to the new node, the new node is
inserted at the position the old node used to have in its parent's child
nodes list if it has one, the user data that was attached to the old node
is attached to the new node.
Copyright Lodovico Giaretta 2016 --