Though, to me it would be worth it for the ease of editing the code.
Yeah, I had thought of that, but in most cases it is better to just filter throught the nodes you are using rather than the whole document. If the document is large, that might do the opposite of my origional intent, to speed up the rendering of the page.
The method I was thinking of was removing any new line feeds and spaces between my divs in the actual source code. @ acorbelli: I would not use that as my editing version but would design a code to sift through my pages to sqeeze them smaller, and there is a second advantage, faster transfer over the internet.
So you'd write the page, run it through this parser, and then upload it? (Or it is created on the web, but still run through the script before accessing).
Sounds neat, might be a little difficult to get the script to understand the difference between a space in your wording and whitespace though, wouldn't it? Unless you use a restrictive one, such as "only remove spaces/newlines if it is between /div and div tags".
Actually, that sounds like a challenge. Hmmm. Looks like I found my next random project.
You may virtually remove the gaps using a DOM circle function before aplying a childNodes' based on method (because, as you might now, IE and Moz conunt in different ways the gaps - noone is strict DOM, by the way), but the question is: Why you want to remove empty spaces. When you will detect the real need, you may find that, for instance, it could be easier some time to use byTagName reference or nodeType contitioner to achieve a crosbrowser code, rather than to remove all the gaps.
On the other hand, physical removing of the gaps would bring the HTML code to an unreadable one. It is almost impossible to follow a long HTML code with no gaps in it....
Why would it concern me if the publishing source was hard to read?
99% of the time you will be forced to update or to modify later the page. If not you, somebody else (if the site is build for a client). It's almost like you were full payed for, let's say, a Flash menu, but you will not deliver the FLA source for a possible future updating.
I've done some work in this area. You can't just remove all whitespace in between nodes because formatting will get screwed up. Even places where it shouldn't matter like between an <img> and a </td> removing spaces can change your layout.
I wrote a program to remove the extra whitespace and display the difference in an alert box. You can see it here: