Subj : Re: JavaScript behavior in Seamonkey To : Samuel Cheung From : Brendan Eich Date : Sat Sep 13 2003 02:29 pm Samuel Cheung wrote: > Could someone please tell me why Mozilla does that? I think if Mozilla > looks for any matching window properpty (in this case "onload") for > every single variable declaration. That will be slow. So I am > wondering what is the reason behind this behavior? > There's no reason for lookup to be "slow" -- hashing is O(1). The ECMA spec clearly states that var does not change a pre-existing property of the variable object, which is the window object at top-level in an HTML or similar DOM level 0 embedding. It has worked this way since I created all this stuff in 1995, in Navigator 2.0. Any IE deviation is a bug in light of compatibility with "Mozilla" (which has been around for a long time, even though the layout engine and lots of other code was rewritten in 1998). /be .