Note: All major browsers, except Internet Explorer, treat empty white-spaces or new lines as text nodes. So, in the example below, there is a function that checks on node type, and displays only Element nodes. This way, the result will be equal in all browsers.