Use localName rather than tagName.toLowerCase() when formatting Elements...

..., to avoid unnecessary confusion.