Sunday, March 21st, 2010
Issue: 20   Editor: Mika


NaN:NaN:NaN. Neverender

For quite some time now the timers on Bootleggers have been returning NaN:NaN:NaN (Not a Number) errors, except the Federal Bank on the Firefox (FF) browser after its new 3.6 update, odd yes? What makes the Federal Bank so special that it was the only timer unaffected? After catching up with three coders The Buzz was able to find reasons behind the errors as well as an answer for the Federal Bank functioning properly.

All three coders agreed that Firefox’s update to its JavaScript (JS) engine and how it sends information to the div (the identifying element of a document) on the page is the root cause, however, they all found a different way to correct this issue.

Altrozero found the easiest correction was just updating the coding to remove all aspects of FF’s tags. “Before it would send 00:00:09. The bootleggers script got rid of the tags and split the time up to use it. However FF changed the output to include extra information in the font tag, which Bootleggers doesn’t get rid of, and this is the code that is creating the problem,” he said.

iPad also found a fairly simple correction to the code stating, “It works fine when the countdown script is by itself and I didn't alter any part of the script, in fact I am linking the JS file on BL.” By doing this he put the exact JS file into his own coding (http://img.bootleggers.us/js/countdown.js) and put the time left counter in a div of its own, also correcting the problem.

Antiriad chose to go the complex route and try multiple codes upon each other to discover the error. At first he discredited Altrozero’s claim that the tags were causing the problem and Bootlegger’s code wasn’t removing all unnecessary JS stating, “To be honest; no as I can't find any font tags within the DIV used to define the timer.” However, after a couple hours of playing with the coding he came to the realization that not all coding was being removed and updated properly.

After placing all of the coding into a dummy page he found that the existing code of

    timeleft = timeleft.replace('', '');
timeleft = timeleft.replace('', '');


was extremely sloppy and needed to be replaced with

timeleft = timeleft.replace(/]+(>|$)/g, ""  ) ;


“Basically that "mess of characters" in the replace is a regex (regular expression used to provide a concise and flexible means for matching strings of text) to remove ALL HTML that may be added,” he said.

In a nutshell, this means that all of the current timers contain sloppy coding that needs updating to align with Firefox’s new, "higher" standard of coding. As for the Federal Bank not being affected the majority have agreed that it’s the only timer currently running on a higher standard, which begs the question, why hasn’t BSF been using that line of coding all along?

Results from the NaN:NaN:NaN survey:

Does the NaN:NaN:NaN error bother you? - Yes (46.81%) - No (51.06%) - Indifferent (2.13%)

Do you care if the NaN:NaN:NaN error is ever fixed? - Yes (48.94%) - No (31.91%) - Indifferent (19.15%)

Do you think BSF will ever fix the NaN:NaN:NaN error? - Yes (34.04%) - No (46.81%) - Indifferent (19.15%)