Welcome to WebmasterWorld Guest from 54.144.107.83

Forum Moderators: phranque

Message Too Old, No Replies

Remove all whitespace between html tags

     
9:59 pm on Oct 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 8, 2003
posts:659
votes: 0


Aside from producing markup that's difficult to read, could there be any unexpected problems parsing html documents to exclude all spaces between ">" and "<"?

I haven't run the following code, but I think it would do it in Perl.
$html_text =~ s/(>)\s+(<)/$1$2/g;

10:05 pm on Oct 7, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 8, 2003
posts:659
votes: 0


What I'd really like to know is if there are cases where it would somehow make sense to have space between ">" and "<" characters
1:14 am on Oct 8, 2004 (gmt 0)

New User

10+ Year Member

joined:June 1, 2004
posts:33
votes: 0


"What I'd really like to know is if there are cases where it would somehow make sense to have space between ">" and "<" characters"
Not that I can think of offhand. It might affect JavaScript, but you can (and should) include that from a separate file.
1:34 am on Oct 8, 2004 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9063
votes: 2


I can't think of any particular problems, other than those if you have anything between
<pre></pre>
tags (which retains the formatting including the souse-code white space).

If you know the content of the pages and you're sure you haven't used

<pre></pre>
anywhere, I'd say go ahead - but keep a backup of the old stuff!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members