* typeof check for undefined and null === null added to make it work in IE < 9