I believe this behaviour is independent of MooTools and the $ function, just 
create a simple html page with an element with an id and type the id into your 
console in Chrome or IE, it will reference it to the DOM element.  This 
wonderful behaviour causes lovely problems if you have a global variable not 
declared with the 'var' statement that has the same name as an element's ID in 
your DOM - hence the importance of properly scoping your variables and avoiding 
globals with a passion!

Cheers

Paul

On 2010-09-21, at 9:44 AM, Gafa wrote:

> If you use "$" on an element in IE7 or Chrome 6.0.4+ you can directly
> reference that element by name/id without the use of "$" in additional
> code?  Is this intended functionality?  Does not work in FF3.6+
> 
> http://www.jsfiddle.net/bSKsc/
> 
> Came across the above, code reviewing another web devs work, and
> couldn't believe what I was seeing.
> 
> Gafa

Reply via email to