Well, I do it because I like XHTML formatting. 

Additionally there is a suggestion here: 
http://livedocs.adobe.com/wtg/public/coding_standards/style.html 
that says: 

CFML & XHTML Compliance

ColdFusion source code cannot quite be written to be purely XHTML-compliant 
because of certain tags (cfif / cfelse, cfreturn, cfset) but you should make an 
effort to be as XHTML-compliant as possible. cfelse cannot have a closing tag 
so it cannot be XHTML-compliant; cfif and cfreturn do not have an 
attribute="value" syntax so they cannot be XHTML-compliant (but cfif has a 
closing /cfif tag and cfreturn can and should have a self-closing /); cfset 
does not in general follow the attribute="value" syntax and these guidelines 
recommend that for readability you do not quote the value in cfset - but cfset 
can and should have a self-closing /. This makes the source code more 
consistent (across CFML and HTML) and will also help you avoid subtle errors 
such as unterminated nested cfmodule calls.

If a simple custom tag invocation is written as XHTML-compliant, i.e., with a 
closing />, it will be executed twice as if it were a paired tag with an empty 
body. This can be surprising at first and cause subtle bugs if your code 
doesn't expect it! You can guard against this in simple custom tags by 
enclosing the code with:

    <cfif thisTag.executionMode is "start">
        ...
    </cfif>

Complex custom tags will probably already use thisTag.hasEndTag and have 
different code executed for thisTag.executionMode is "start" and 
thisTag.executionMode is "end".

All built-in CFML tags should be written as XHTML-compliant where possible 
(cfif, cfelse, cfset and cfreturn are notable exceptions).


Terrence Ryan
I.T. Director
Wharton Computing and Information Technology       
E-mail:         [EMAIL PROTECTED]



-----Original Message-----
From: Robert Harrison [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 12, 2007 3:05 PM
To: CF-Talk
Subject: XHTML Style CF?

I've noticed some other programmers are now using a close tag indicator in
stand-alone cftags, like <cfset myvar=0 />.

 

As far as I know it's only an XHTML requirement to close all tags (e.g., <br
/>) and not a CF issue.  Since CF never outputs CFtags to the browser is
this actually necessary?

 

 

Robert B. Harrison
Director of Interactive services
Austin & Williams
125 Kennedy Drive, Suite 100 Hauppauge NY 11788
T : 631.231.6600 Ext. 119 

F : 631.434.7022
www.austin-williams.com

Great advertising can't be either/or... It must be &.






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288310
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to