I found that when we updated from CF 4.01 to MX and I turned on the server setting to 
remove whitespace my javascript started to break as well.  In this case it was due to 
bad coding practice.  I was neglecting to put ';' at the end of each statement so when 
the server removed the whitespace I would end up with several statements on 1 line.  
So I went through and put the ;'s in and everything started working.

What made me think of this was the javascript code you gave.  Basically the 2 lines:

     // return message
     return this.lang_data[_block][arguments.message];

Could end up as 

     // return message return this.lang_data[_block][arguments.message];

causing it to treat it as a comment.

Just my $.02 worth.
______________________________________________________ 

Bill Grover     
Supervisor MIS                  Phone:  301.424.3300 x3324      
EU Services, Inc.               FAX:    301.424.3696    
649 North Horners Lane          E-Mail: [EMAIL PROTECTED]
Rockville, MD 20850-1299        WWW:    http://www.euservices.com
______________________________________________________ 



> -----Original Message-----
> From: Mauricio Giraldo [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 27, 2003 5:44 AM
> To: CF-Talk
> Subject: whitespace is breaking my javascript
> 
> 
> hello
> 
> thanks for all the input on different issues i have presented 
> in this list. 
> this is really THE place for CF stuff.
> 
> right now i am having a really particular issue with 
> coldfusions whitespace. 
> i will try and explain as much as i can:
> 
> 1- i have a few CFCs (calling each other, extending each other)
> 2- one CFC function is a wrapper to another (a shorthand 
> version) and their 
> object is returning texts for dialog boxes and javascripts
> 3- more or less the cf:
> 
> <cffunction name="m" hint="shortcut for showMessage">
>   <cfargument name="message" type="string">
>   <cfargument name="block" type="string" default="">
>   <cfreturn this.showMessage(arguments.message, arguments.block)>
> </cffunction>
> 
> <cffunction name="showMessage" hint="return message">
>   <cfargument name="message" type="string" default="">
>   <cfargument name="block" type="string" default="">
>   <cfscript>
>   // return message
>     return this.lang_data[_block][arguments.message];
> </cfscript>
> </cffunction>
> 
> theres more CFML (especially in showMessage) but just so you 
> get an idea.
> 
> i am outputting texts using something like: 
> <cfoutput>#obj.m("special_string")#</cfoutput> where 
> "special_string" is 
> some string i use in showMessage to detect stuff (it is a 
> multi-language app 
> with a lot of parametrization)
> 
> the problem:
> 
> i am getting A LOT of whitespace. whenever i use those (and 
> other) functions 
> it breaks all javascript (that is also dynamically created 
> with CF and those 
> functions). tried using CFSETTING but i simply cannot put that many 
> cfoutputs all over the place (tried also combining m and 
> showMessage in 
> one). one way i "solved" it was using <cfset myvar = 
> obj.m("special_string")> someplace before the javascript and 
> then just 
> outputting #myvar# in the javascript. the problem is i have A 
> LOT of CFC 
> invocations (a single page can have 60+ and i have a few 
> dozen pages) and it 
> just would not make sense. i am looking for a way to 
> minimize/eliminate 
> whitespace generated when invoking functions.
> 
> i really need this to work (will share the app as soon as i have it 
> finished... its actually finished but the javascript is breaking... 
> whitespace solved EQ app finished)
> 
> i will appreciate any help on this issue
> 
> thanks a lot
> 
> - mga
> 
> _________________________________________________________________
> Help protect your PC: Get a free online virus scan at McAfee.com. 
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to