also, you break the spec. MooTools implements methods from the current spec
back into browsers that don't have them. So IE gets each, but everything
else uses the one in the browser. This is faster of course, but more
importantly, MooTools doesn't break the spec.

On Sun, Dec 6, 2009 at 2:29 PM, Christoph Pojer
<[email protected]>wrote:

> * The only problem is that you overwrite each and therefore not use
> the native (and fast) forEach any more.
>
> On Dec 6, 11:28 pm, Christoph Pojer <[email protected]> wrote:
> > quite a fun idea actually.
> >
> > On Dec 6, 4:50 pm, cheeaun <[email protected]> wrote:
> >
> >
> >
> > > This is what I did last time, which uses 'return false' to 'break':
> http://gist.github.com/219390
> >
> > > But also, I would say using every/some would be better.
> >
> > > On Dec 6, 3:35 pm, אריה גלזר <[email protected]> wrote:
> >
> > > > i don't see how this can be the answer. logically, every and some are
> both
> > > > "sorting" methods. they are not supposed to tamper with the arrays,
> only to
> > > > verify them. i can understand that if Array#some breaks on the 1st
> true
> > > > returned you could use it to manage such a hack, its not what it was
> meant
> > > > to do.
> >
> > > > i would think adding a break method could be nice. something like
> >
> > > > array.each(function(e){
> > > >   /*do some actions to e*/
> > > >   if (e==some_condition){
> > > >     array.break();
> > > >     return;
> > > >   }
> >
> > > > }
> >
> > > > though i guess if the implementation for each is derived from native
> > > > function this isn't doable....
> > > > -----------
> > > > אריה גלזר
> > > > 052-5348-561
> > > > 5561
> >
> > > > On Sat, Dec 5, 2009 at 16:45, Perrin Perrin <
> [email protected]>wrote:
> >
> > > > > I would suggest looking into Array.every or Array.some.
> >
> > > > >http://www.mootools.net/docs/core/Native/Array#Array:every
> > > > >http://www.mootools.net/docs/core/Native/Array#Array:some
> >
> > > > > Example:http://mooshell.net/Krwy6/1/
> >
> > > > > On Sat, Dec 5, 2009 at 7:21 AM, Steve Onnis <
> [email protected]>wrote:
> >
> > > > >>  i saw mention of that when i googled.....i would rather not be
> creating
> > > > >> errors on purpose. not a fan of hacks so just did it in a "for"
> loop. No
> > > > >> biggie
> >
> > > > >>  ------------------------------
> > > > >> *From:* Thierry bela nanga [mailto:[email protected]]
> > > > >> *Sent:* Sunday, 6 December 2009 12:14 AM
> > > > >> *To:* [email protected]
> > > > >> *Subject:* Re: [Moo] Re: Break out of an each loop
> >
> > > > >> you could use try/catch to exit like this,
> >
> > > > >>http://mooshell.net/nM8SS/2/
> >
> > > > >>  <http://mooshell.net/nM8SS/2/>
> >
> > > > >> On Sat, Dec 5, 2009 at 1:54 PM, Kevin Valdek <
> [email protected]>wrote:
> >
> > > > >>> Except calling empty() on the array or collection each time you
> brake
> > > > >>> is probably something you don't want to do.
> > > > >>> Instead, consider using the good old for loop, where the break
> > > > >>> statement works fine.
> >
> > > > >>>http://mooshell.net/nM8SS/1/
> >
> > > > >>> Kevin
> >
> > > > >>> On Dec 5, 1:38 pm, Dirar Abu Kteish <[email protected]>
> wrote:
> > > > >>> > What are you trying to do? if you have an array of any kind,
> you can
> > > > >>> set a
> > > > >>> > variable that simply say if you want to continue with the
> function or
> > > > >>> not or
> > > > >>> > do as in herehttp://mooshell.net/NcKYE/1/
> >
> > > > >>> > On Sat, Dec 5, 2009 at 1:21 PM, Steve Onnis <
> [email protected]>
> > > > >>> wrote:
> > > > >>> > >  Is there a way to exit out of an each() loop?  i have tried
> "break"
> > > > >>> but
> > > > >>> > > doesnt work
> >
> > > > >>> > > Steve
> >
> > > > >>> > --
> > > > >>> > Dirar Abu Kteish
> > > > >>> > Zan Studio
> > > > >>> > Web Development Manager
> > > > >>> > Mob.:+970-597-100118
> > > > >>> > website:www.zanstudio.com
> >
> > > > >> --
> > > > >>http://tbela99.blogspot.com/
> >
> > > > >> fax : (+33) 08 26 51 94 51
>

Reply via email to