Closing Tags with Slashes: An Informal Survey

How many ColdFusion programers out there are religious about closing their tags? In other words, are you more likely to do this…

<cfreturn foo>

… or this …

<cfreturn foo/>

How about your HTML tags? Strict, transitional, or “freestyle”?

15 Responses to Closing Tags with Slashes: An Informal Survey

  1. Ron says:

    I always close the tags – ever since XHTML came out. It just seems more proper and standard. As far as HTML, I strive for strict but almost end up in transitional.

  2. Todd says:

    I used to, then I realized it was just a trendy thing to do. I was kind of confused when I saw it in the MM help files, etc. And, it wasn’t consistent either. Some examples you would see them, other examples you wouldn’t. I don’t do it anymore. I’ve found that the junior developers would panic and yell at me for not telling them something, so I quit doing it.

  3. I try to always close my tags to maintain an overall XHTML look’n’feel to my code as well as XHTML compliance in generated code. My personal site is transitional at the moment but I’ll be working on strict compliance soon (and hoping to achieve full renderability in the DENG browser!).

  4. I don’t see the point of closing single-tag CFML elements… there’s no real benefit, and in the case of a custom tag, some definite downsides. I’m not passionate about it, though. I just don’t care. :)And I don’t really care about XHTML, either. It’s a solution in search of a problem, IMO.

  5. Mike B says:

    HTML – yesCFML – yes and nowithin a block of html i always close single cf tags, just for consistency. otherwise, i usualy dont bother.if the next version of cf requires us to close all tags, thats fine by me.

  6. JR says:

    Ok… but who out there does this?<BR/>I generally try close all trags CFML and HTML (and end a .AS line with a ‘;’ ) — but the break tag? I can’t bring myself to do it.

  7. Robby says:

    Just think if it was able to handle closing tags though. on everything,Break it down real quick, coldfusion at times gets its hell from other “insert language” developers because _it_is_ tag based, which breaks tradition of the more common languages. (I’m not portraying this comment, nor am I defending it, but it has been mentioned from time to time.).With that said, . what if your coldfusion code was “able” to be xml compliant. Not only is it a web application language, . but it’s also the only true language that can be parsed and treated like an xml doc, . which depending on it’s situation could have inherited benefits,. self documentation (outside of a cfc), .CVS, wiki, etc.I dunno, . I’m a heavy cfscripter myself, . I like the speed improvements that comes with it. But, . just the fact it’s there is a natural bonus.. IMO..and JR, I do ;o), . it’s an empty node.Robby

  8. Samuel Neff says:

    I use strict for HTML but recently realized it can actually break compatibility with NS4. This code:caused problems in NS4, you need to put a space in it:Lately I’m only doing Flash work for front end anyways so i don’t have to worry about it anymore.

  9. Samuel Neff says:

    huh, seems you can put html in there.. try that again..breaks ns4..<br/>works ok<br />

  10. I think that we are all creatures of habit. If you have a standard operating Proceedure (SOP) for any development, you should stick with it. Usuing XHTML standards when you are creating html, but not using it when “CF’ing it”, will only lead to confusion. It won’t be long til you will have spent a week working on CF and then build a couple dozen pages in stright html and you’ll forget to close your html tags.I also think having a strict standard for tags helps reinforce HTML & CF development as a true structed programming exercise. Also, IMHO I think that if you are training more junion programmers, you should teach them a standard they can use throughout your apps., AND prepare them for XML-centrict issues later.

  11. Brian LeRoux says:

    I always use xml style syntax. Just a good habit to be in. BTW, as Samual Pointed out, well formed xml *should* have a space at the end ala . And always all lowercase. Yes, it does wreak havoc on custom tags but whatever.Someone mentioned XHTML is a solution in search of a problem and I find that to be a shame coming from any developer. Like it or not standards help everyone in the long run and as professionals we should always be striving for excellence in our work. Embracing standards is one way we can do just that. Accessibility for the disabled is only one benefit of device independence through standards; it doesn’t take much of an imagination to think of others.I also disagree about the statement of CFML taking flack for being a tag based language; that may have been the case a few years ago but take a look at ASP.Net and JSP– both tag based. CF must be doing something right for both Microsoft and Sun to follow suit.

  12. Christian Cantrell says:

    Actually, I think that adding the space before the slash has nothing to do with well-formedness. I think it is simply to make the tag compatible with non-XHTML compatible browsers like Netscape 4.x.Christian

  13. Massimo Foti says:

    I try to stick with XHTML whenever I can and I am considering to get into the habit of using well formed XML syntax for my CFML code as well. It may be handy in case you want to run an XML parser over your source code.Before going for it, I have to adapt my custom tags and customize both Homesite and DW MX.I think having .cfm files that are also well formed XML files makes sense, but I am not religious about it

  14. Mark Crawford says:

    I love CF but the fact that it’s the only tag-based system that isn’t xml compliant is really embarrassing. It makes it harder to convince people that it is a modern and capable system like it is.It’s not just about slashing on single tags, it’s about the whole xml specification. CF developers have gotta stand up and take a look around ourselves and not be ignorant of the rest of the industry.

  15. lo says:

    like this