This is a feature of IE. It seems like Chrome emulates it for
compatibility reasons. Consider this a leftover from the early days of
the Internet. This is not related to MooTools *at all*.

On Sep 21, 4:01 pm, Gafa <[email protected]> wrote:
> Paul,
>
> Humm, didn't try it straight out of the box.
>
> I don't think I have ever tried to reference an element with or
> without Mootools directly by name/id in Javascript.  Interesting
> functionality.  Agree about globals.
>
> "wonderful behavior", ahh yes... NOT!  Unless the dev wants to create
> additional code/error/bug headaches for themselves and or others.
>
> Gafa
>
> On Sep 21, 9:52 am, Paul Spencer <[email protected]> wrote:
>
>
>
>
>
>
>
> > 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