I wonder if we can optimize it a bit by doing this:
- Clone `element` deeply
- Loop over elements, until we find a child with content, delete all the other nodes.
- Loop over elements backwards, until we find a child with content, delete all the other nodes.