Wednesday, March 12, 2025

Broken Up With – The Daily WTF

Programming LanguageBroken Up With - The Daily WTF


Marco found this wreck, left behind by a former co-worker:

$("#image_sample").html('<i><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />No image selected, select an image to see how it looks in the banner!</i>');


This code uses the JQuery library to find an element in the web page with the ID “image_sample”, and then replaces its contents with this hard-coded blob of HTML.

I really appreciate the use of self-closing, XHTML style BR tags, which was a fad between 2000 and 2002, but never truly caught on, and was basically forgotten by the time HTML5 dropped. But this developer insisted that self-closing tags were the “correct” way to write HTML.

Pity they didn’t put any thought in the “correct” way to add blank space to page beyond line breaks. Or the correct way to populate the DOM that isn’t accessing the inner HTML of an element.

At least this was a former co-worker.

[Advertisement]
ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.

Check out our other content

Check out other tags:

Most Popular Articles