Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion .get() vs .toArray(), .get(index) vs [index]

MIME-Version: 1.0
Received: by 10.100.197.3 with SMTP id u3mr2373678anf.6.1233009843222; Mon, 26 
	Jan 2009 14:44:03 -0800 (PST)
Date: Mon, 26 Jan 2009 14:44:03 -0800 (PST)
In-Reply-To: <4d767a1e-1940-4ab2-97e9-67e50eb79205@v18g2000pro.googlegroups.com>
X-IP: 81.15.13.119
References: <fb1da748-026b-4aab-a9a2-78fea4ebfc54@i18g2000prf.googlegroups.com> 
	<730bab940901261110u7e5a14e7sac2c39291ce810ad@mail.gmail.com> 
	<4d767a1e-1940-4ab2-97e9-67e50eb79205@v18g2000pro.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) 
	AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19,gzip(gfe),gzip(gfe)
Message-ID: <b35f4799-83cd-4eaa-86de-f340ea5b60c5@x16g2000prn.googlegroups.com>
Subject: Re: .get() vs .toArray(), .get(index) vs [index]
From: =?ISO-8859-1?Q?M=E1r_=D6rlygsson?= <mar.orlygs...@gmail.com>
To: jQuery Development <jquery-dev@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Robert: while I agree with you that the whole .get() thing has always
seemed kind of weird, it's now part of jQuery history and cannot be
easily changed.

If it bugs you, just write your own alias:

    jQuery.fn.toArray =3D jQuery.fn.get;

...and make sure to always access single element with

  collection[index];

rather than

  collection.get(index);

And you'll never notice the difference.

--