Posted on Leave a comment

Yesterday’s Coding Horror

Yesterday my web application quit working. I simply cleared the domain cookies and the session cookies. It should have been no big deal but an important piece of JavaScript quit working. I have a script that adds some HTML to the DOM and looks similar to:

snafu("<tr><td class=\"fooclass\"><a class=\"expander special\" href=\"index.php\">go somewhere</a></td></tr>");

So this worked fine until I cleared cookies and now the generated source in the browser (confirmed in Firefox and Chrome) looks like:

snafu("<tr><td class=\"fooclass\"><a class="\""expander special\" href=\"index.php\">go somewhere</a></td></tr>");

Note that the anchor has inexplicably changed from <a class=\"expander special\" href= to <a class="\""expander special\" href=. The obvious thought is that a session variable is being expected in building the javascript code which in turn changes the DOM but that session variable is now returning NULL. That is still likely to be the problem but yesterday’s line by line inspection of the code showed no flaws. Today I am going to eliminate the server as an issue. The most recent code changes have not been migrated to the production server and it does not reproduce the problem so I’m setting up a staging server today to see if it shows the same problem as the development server. What a pain!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.