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
_each method and context
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Yaffle  
View profile  
 More options Feb 16 2009, 7:29 am
From: Yaffle <vic99...@yandex.ru>
Date: Mon, 16 Feb 2009 04:29:55 -0800 (PST)
Local: Mon, Feb 16 2009 7:29 am
Subject: _each method and context
Hello,

Why with JavaScript <= 1.5,  Array.prototype._each method doesn't use
a context object

like

Array.prototype.forEach(callback[, thisObject]) in JavaScript 1.6

or

Enumerable.prototype.each(iterator[, context]) ?

thank you.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kangax  
View profile  
 More options Feb 16 2009, 11:16 am
From: kangax <kan...@gmail.com>
Date: Mon, 16 Feb 2009 08:16:05 -0800 (PST)
Local: Mon, Feb 16 2009 11:16 am
Subject: Re: _each method and context
On Feb 16, 7:29 am, Yaffle <vic99...@yandex.ru> wrote:

> Hello,

> Why with JavaScript <= 1.5,  Array.prototype._each method doesn't use
> a context object

> like

> Array.prototype.forEach(callback[, thisObject]) in JavaScript 1.6

> or

> Enumerable.prototype.each(iterator[, context]) ?

> thank you.

Because `Array.prototype._each` (defined by Prototype.js) is bound to
custom `each` implementation when native `Array.prototype.forEach` is
unavailable (e.g. in older versions of Firefox). That custom
implementation currently looks like:

function each(iterator) {
  for (var i = 0, length = this.length; i < length; i++)
    iterator(this[i]);

}

while, to be consistent with `forEach`, it would need to look like:

function each(iterator, context) {
  for (var i = 0, length = this.length; i < length; i++)
    iterator.call(context, this[i], i, this);

}

--
kangax

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobie Langel  
View profile  
 More options Feb 16 2009, 6:09 pm
From: Tobie Langel <tobie.lan...@gmail.com>
Date: Mon, 16 Feb 2009 15:09:23 -0800 (PST)
Local: Mon, Feb 16 2009 6:09 pm
Subject: Re: _each method and context
Can you open  a ticket for this?

Thanks,

Tobie

On Feb 16, 5:16 pm, kangax <kan...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kangax  
View profile  
 More options Feb 16 2009, 11:13 pm
From: kangax <kan...@gmail.com>
Date: Mon, 16 Feb 2009 20:13:15 -0800 (PST)
Local: Mon, Feb 16 2009 11:13 pm
Subject: Re: _each method and context
On Feb 16, 6:09 pm, Tobie Langel <tobie.lan...@gmail.com> wrote:

> Can you open  a ticket for this?

Sure, patch and test attached.
http://prototype.lighthouseapp.com/projects/8886-prototype/tickets/55...

--
kangax


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »