Rewrite pretty-printing HTML elements to prevent throwing internal errors
Fixes errors occuring when using a non-native DOM implementation
Merge pull request #275 from DrRataplan/master

Rewrite pretty-printing HTML elements to prevent throwing internal errors