Strip whitespace and javascript comments
When you make use of a function to strip whitespace, like for instance the two examples I have on this site (see below) you have to make sure that you have commented your javascript in the right manner, otherwise you don't get the result you want.
Strip whitespace will remove all linebreaks, tabs en double spaces from your code.. and the tricky part is the linebreaks. Take a look at this piece of code.
<script>
//alert the user.
alert('Eeej!!');
</script>
After strip whitespace the complete statement has become a comment, because you didn't close the comment.
<script>//alert the user. alert('Eeej!!');</script>
Correct way of having comments in your code is like this.
<script>
/* alert the user. */
alert('Eeej!!');
</script>
This way the code won't break down when you use a whitespace removal script or tool. Also important in this manner is the use of the ; to close every line of code!!
links:
http://www.mximize.com/index.cfm?searchword=whitespace
8970 viewed | Your opinion... | del.icio.us | Digg it | Tjarko @ 18/08/06 11:26 cet



