So, here is normal text: just your standard paragraph.

I have javascript that will insert a span around selected text (for highlighting purposes).
The problem is that when I remove the span, the nice text block becomes chunky, and malformed:

How do I restore the block of text to its original state?
I think you must to keep the original node, and replace it cloning the innerHTML with your span-wraper. Then just replace the nodes.