in IE ... all elements with IDs are already in the global scope
This I can confirm. If the page contains this:
<div id="bob">Hi</div>
bob == $("bob")
The issue comes when you do something more like this.
<script> var bob = "hello world"; </script> <div id="bob">Hi</div>
One might expect this, given the above, but I tried it in both IE6 and IE7 and the global keeps the value it had before.
End of the day though it's a bad idea and at some point you'll clobber variables you didn't want to.
in IE ... all elements with IDs are already in the global scope
This I can confirm. If the page contains this:
then the following evaluates to true in IE: ...without defining the variable. I didn't know that - thanks!The issue comes when you do something more like this.
now bob doesn't equal "hello world". Your global has been clobbered.One might expect this, given the above, but I tried it in both IE6 and IE7 and the global keeps the value it had before.