Script components & methods don't need output = false
Monday January 25, 2010 12:30 PM
Word Count: 274
With the upgrades of cfscript in ColdFusion 9 I am starting to see a lot more components written in script(Yes!). With that I am starting to see a lot of the following. First off Its just a personal preference but attributes after the method arguments is really ugly. If you notice the output for both the component and the method has been set to false. While this was needed in tag based components this is not required in script based components. Nathan Strutz has a really good explanation of this over on Stack Overflow . Nathan's short answer is below but I would head over to the site and check out the full explanation.
cfscript does not output anything unless you explicitly call writeOutput() from it. This includes functions in cfscript as well as any cfscript code outside of a function. This is different from CF tags' syntax, which, by default, output at least whitespace between the tags. In cfscript, any text you write will be compiled by the CFML engine. in CF tags, any text you write will be written to the output buffer and sent to browser.
