So I sit down tonight to make some layout changes to a client’s website. The changes were minor, moving a form from the bottom of the page to the top and shifting some data around. No big deal, right? The code in question involves some external javascript code supplied by a third-party vendor. No big deal, I thought. Famous last words.
I move the code around and refresh the page. There is significant lag while the browser tries to render the form. Odd, I think, but maybe the server the javascript is being pulled from is slow. Better to pull the javascript local, right? I pull the code down and crack it open, with the intent of either embedding it directly in the page or at least pull it from a local file.
Holy shit what a disaster.
The file consisted of 5 lines of code, only one of which was actually necessary. The problem was that the single line was approximately 46,838 characters long. Yes, you read that right: 46,838 characters.
Let this serve as a public plea to anyone who develops web applications in any form: For the love of all that is sacred, never, ever, neglect the endline. Endline characters are my friend. They should be your friend, too. If you can’t grasp the fact that an application, especially a web browser, might have problems handling FOURTY SIX THOUSAND characters without a line break, then I have one favor to ask: find a new line of work. People like you make it more difficult for people like me to do my job. Sure, I get to play the part of hero when I show my client their “new and improved website” that loads an order of magnitude faster because I simply applied sane whitespace rules. At the end of the day, however, I would rather spend my time doing my job and not cleaning up your crap.