IE native functions “bug”?

In my article about method closures I showed a way to neatly create a portable reference to an object method that doesn’t  ‘forget’ the object it belongs to. I have since discovered an aggravating problem on – you’ll never guess – Internet Explorer!

It only affects native objects, e.g. window.alert. Before testing any complex code you can see that there is a problem by simply doing the following:

alert( typeof window.alert );

You would expect this to alert “function”, but it does not. It alerts “object”, which explains the result of the next test.

alert( );

You would expect this to alert “function” too, but it is actually undefined. The alert method of the window object is apparently not a Function object, which explains a lot of the IE-specific problems you encounter when you mess about with native objects.