[Webkit-unassigned] [Bug 16857] New: defining existing variable with var statement dumps original

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jan 12 15:33:04 PST 2008


http://bugs.webkit.org/show_bug.cgi?id=16857

           Summary: defining existing variable with var statement dumps
                    original
           Product: WebKit
           Version: 525+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.5
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: somefoolwitha at gmail.com


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


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list