Christian Heilmann

How superfluous commenting can bite you

Saturday, October 29th, 2005 at 8:55 am

i just had a fun bug to kill: A client complained that their site is not working. The code is theirs, all we did was update some flash movies. What didn’t work, was a popup window showing the flash movie.

Now, the code was Dreamweaver generated and the out-of-the-box functions have their version as comments on the line of the function name:


function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

There seems to be some optimising setting on the client’s server that deletes all whitespace in the documents, and when they uploaded the above code, it ended up as:


function MM[...]([...]) {//v2.0window.open([...]);}

This commented out the whole function and broke the popup. Learning from that: Don’t use embedded JS in an unknown environment.

Share on Mastodon (needs instance)

Share on Twitter

My other work: