Hmmm... interesting... thanks, Andrea! Brainstorming: what about a $.each2 method, to avoid messing with the original signature (name + parameters), but using Array.prototype.forEach?
Diogo On May 18, 11:29 am, Andrea Giammarchi <[email protected]> wrote: > it's not about the name, it's about arguments plus returned value. > I do not know why John decided at that time to make jQuery.fn.each "a bit > redundant" avoiding JS 1.6 forEach MDC specs and limiting performances boost > via native callback ( it would be a double wrap, one to return the jQuery > object plus one to swap arguments into forEach ). > > prototype.each = function(callback){ > var $this = this; > Array.prorotype.forEach.call(this, function(el, i, all){ > callback.call($this, i, el); > }); > return this; > > }; > > Above snippet will decrease performances, rather than increase them ... > > If interested, with vice-versa you have perfromaneces focused Array JS 1.8 > methods in every browser:http://code.google.com/p/vice-versa/ > > Regards > > On Mon, May 18, 2009 at 3:19 PM, Diogo Baeder <[email protected]> wrote: > > I know that the Array.prototype.forEach method implementation and $.each > > differ in signature, but was this discussion ever raised here at the list to > > consider the performance boost? I think IE8, for example, has already > > implemented these newer JS methods, already... (I've not tested it yet, but > > will soon.) > > > Thanks! > > > __________________________ > > Diogo Baeder > >http://www.diogobaeder.com.br --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
