— a blog about web development and whatnot by Steve Webster

  1. Firefox doesn’t hoist function declarations in blocks

    At work we include a third-party JavaScript library on our pages so we can run A/B and multivariate testing, and this code requires at least jQuery 1.4.0. Unfortunately we have more than a few dark corners of our site that are still dependent on an old (1.2.x) version of jQuery, so I had to find a way to detect the version of jQuery and not invoke the A/B testing code if we didn’t have the appropriate version. This proved to be more complicated than I thought, thanks to the way Firefox (actually SpiderMonkey) handles function declaration in blocks.