When defining a variable with a var-statement in the global scope, and window[varname] already exists, window[varname] is deleted before the code block is actually executed. Example with window.Element: http://mirror.ikhoefgeen.nl/mootools/711/element_test.html The following code in in nightly build 29385: > document.write(typeof window.Element); > var Element = 'foobar'; > document.write(typeof window.Element); results in > undefined > string where omitting the var statement > document.write(typeof window.Element) results in the expected > object Other browsers, for example Firefox 2.0.0.2 and Opera 9.25 produce: > function > string Tested with Webkit Nightly build 29385, Mac OS X 10.5.1 Intel
Please test again with a WebKit nightly build of r29428 or later. See Bug 16644.
Works like a charm :-) Testcase returns 'object' as expected.