Bug 16857
Summary: | defining existing variable with var statement dumps original | ||
---|---|---|---|
Product: | WebKit | Reporter: | Jelmer van der Linde <somefoolwitha> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ggaren |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac (Intel) | ||
OS: | OS X 10.5 |
Jelmer van der Linde
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
David Kilzer (:ddkilzer)
Please test again with a WebKit nightly build of r29428 or later. See Bug 16644.
Jelmer van der Linde
Works like a charm :-)
Testcase returns 'object' as expected.