Fix the case where there is no tagName and node_type != 3

This happens when you paste from Microsoft Word and get weird HTML (with inline XML, comments, etcetera).