RESOLVED FIXED 16857
defining existing variable with var statement dumps original
https://bugs.webkit.org/show_bug.cgi?id=16857
Summary defining existing variable with var statement dumps original
Jelmer van der Linde
Reported 2008-01-12 15:33:03 PST
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
Attachments
David Kilzer (:ddkilzer)
Comment 1 2008-01-12 16:17:59 PST
Please test again with a WebKit nightly build of r29428 or later. See Bug 16644.
Jelmer van der Linde
Comment 2 2008-01-12 16:35:06 PST
Works like a charm :-) Testcase returns 'object' as expected.
Note You need to log in before you can comment on or make changes to this bug.