Fix a SEGV when deinitializing an external element

Basically the issue is that the tag name is requested after
the data is removed. We better cache the name, but for now
we just add some guards.
Also be able to identify an external element
Split the process event from the mutation events

Also improve the event handling