Yes, I made an writing error. The second case (!his[i]) would return an jquery with the not-true value instead of an empty one. This was the reason of Ricardo's not entirely correct solution, I suppose.
On Mar 2, 10:10 pm, Robert Katić <[email protected]> wrote: > I figured out (unfortunately not before) that the main reason why the > current implementation uses slicing is to ensure correct behavior in > case of "index out of range" and in case of !this[i]. > Here proposed solutions will not return an empty jquery in that cases, > but an jquery with the document element. > > Maybe this would be more appropriate: > > eq: function( i ) { > return this.pushStack( i == -1 ? arraySlice.call(this, i) : > arraySlice.call(this, i, +i + 1), 'eq', i ) > > } > > Unfortunately this looks dirty with no significant performance > improvements in respect of the first solution I purposed > onhttp://dev.jquery.com/ticket/4188. > > Any better idea? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
