Reply
Do spaces in JS make a difference?
Old 10-28-2009, 02:49 PM Do spaces in JS make a difference?
Experienced Talker

Posts: 47
Trades: 0
Is:
Code:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-Hide");
pageTracker._trackPageview();
} catch(err) {}</script>
The same as:
Code:
<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script><script type="text/javascript">try {var pageTracker = _gat._getTracker("UA-Hide");pageTracker._trackPageview();} catch(err) {}</script>
DynamicFlooder is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 10-28-2009, 04:25 PM Re: Do spaces in JS make a difference?
chrishirst's Avatar
Super Moderator

Posts: 22,257
Location: Blackpool. UK
Trades: 0
Nope. White space makes no difference at all.

just as long as the commands are terminated with a semicolon.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-28-2009, 05:55 PM Re: Do spaces in JS make a difference?
treyk4's Avatar
Skilled Talker

Posts: 80
Name: Trey
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Nope. White space makes no difference at all.
Well, they'll bloat your code =)

If it's compressed code that your looking for, try the YUI compressor. It makes your code pretty much impossible to read, but as long as you have a back-up you're good.
http://yui.2clics.net/
__________________
Decatur-Austin Robotics Coalition (DARC) - http://darcrobotics.org
treyk4 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Do spaces in JS make a difference?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.14730 seconds with 13 queries