Category Archives: Uncategorized

Var statement and ie8

Today I came across a weird bug in internet explorer 8 and downwards that is incompatible with standard javascript.

Internet explorer 8 threw exceptions about undefined variables when we were referencing third party dependencies like domready and yepnope.

SCRIPT5007: Unable to get property ‘yepnope’ of undefined or null reference

The error boils down to the following test case


window.myLib = {};


var myLib;


Include myLib.js and fault.js with script.

myLib and window.myLib will be undefined when running this on ie8 for some reason.

Now if I declare myLib like this :

var myLib = {};

there will be no problem in fault.js.

Ie8 also has some known errors when it comes to using var, for example typing var window; will throw “SCRIPT5039: Redeclaration of const property” as an exception.

For now I would not recommend using var in the window scope at all if you are targeting IE8.