From time to time I’ll encounter a CFC that is ‘broken’ in the outline. By broken I mean the method listing goes up to a certain point and just plain stops. I don’t encounter this very often, but when I do, it’s normally a case of needing to find some method after the mysterious stopping point. I brought this up with Adobe, and used a specific file as an example, and today Ramchandra (Adobe engineer) shared with me what the issue was - invalid HTML.
Let’s look at an example of this. The following CFC closely resembles the one that originally had a broken outline.
<cffunction name="badboy"> <cfset var str = ""> <cfsavecontent variable="str"><tr></cfsavecontent> <cfreturn str> </cffunction> <cffunction name="goodboy"> <cfreturn "<tr>"> </cffunction> <cffunction name="placeholder1"> <cfreturn 1> </cffunction>
Notice the very first method, badboy, returns a TR tag. This is perfectly valid CFML. You could imagine a real use for this - perhaps in a method called startTableRow. And yea - this would be way over enginered - but I’ve bet we’ve all seen code like that before. Check out what the outline does with it though:
As you can see, it stops at badboy and doesn’t render anything past that. If we comment out badboy we get:
Now - in the code above - there is really no bug. In my original CFC shared with Adobe there definitely was. (This is in Galleon and will be fixed today.) I’ve made the argument that the code above should not break the outline. That being said though - if you have outline issues - check for something like this.
On a related note, I’ve noticed that CFBuilder will not correctly flag invalid HTML. Create a new HTML file in CFBuilder, write a B tag and don’t close it, and you get no error or warning. Do the same in Aptana. I’ve asked about why this happens and if I find out I’ll post back.