The Right Helper – The Daily WTF

Date:

Share:

Greg was fighting with an academic CMS, and discovered that a file called write_helper.js was included on every page. It contained this single function:

function document_write(s)
{
   document.write(s);
}

Now, setting aside the fact that document.write is one of those “you probably shouldn’t use this” functions, and is deprecated, one has to wonder what the point of this function is. Did someone really not like object-oriented style code? Did someone break the “.” on their keyboard and just wanted to not have to copy/paste existing “.”s?

It’s the kind of function you expect to see that someone wrote but that isn’t invoked anywhere, and you’d almost be correct. This function, in a file included on every page, is called once and only once.

More like the wrong helper, if we’re being honest.

Source link

Subscribe to our magazine

━ more like this

‘This is the real Santa’s workshop’: a trip to Germany’s toy village | Germany holidays

I feel terrible … I’ve left the children at home and Seiffen, nicknamed Spielzeugdorf (The Toy Village), is literally a Christmas wonderland. Every street...

Snapshot: Viaweb, June 1998

January 2012A few hours before the Yahoo acquisition was announced in June 1998 I took a snapshot of Viaweb's site. I thought it might be...

THE 16TH ANNUAL JAMES GARFIELD CHRISTMAS MIRACLE! – The Bloggess

Hello and welcome to the SIXTEENTH ANNUAL James Garfield Miracle! (HOW??) “What is the James Garfield Miracle?” you may be asking. You must be new here. HELLO...

Amal Clooney Wore My Ideal French Outfit Combo in Provence

Amal Clooney certainly has a way of sparking FOMO. Her red carpet style is nothing short of glamorous, while her off-duty outfits are seriously...

Sofia Vergara Is Aging Confidently and Embracing Her 50s

There's also a global double standard around aging that extends beyond Latin American culture. Women are expected not to age, yet they're also judged...