toArray(5) instead of get(5) is not clear either. Doesn't make sense to create an Array passing an index that will act as a filter. If I recall correctly, foo[index] was not possible until jQuery 1.2, the .get() method came first.
You could argue that eq(), attr() or val() make code less readable too, it's a matter of personal taste. I think jQuery dev team has done a good job of keeping method names sane. cheers, - ricardo On Jan 26, 4:14 pm, Robert Katić <[email protected]> wrote: > My English is not so good so will be short. > > I am not sure why the get() function exists. Because it is shorter > then toArray()? But my code would by more clear with an toArray > instead, An foo.get(index) is not clearer nor shorter then foo[index] > for me. > > In my opinion the "get" function is not really necessary and would by > deprecated if an more explicit toArray would exists. > > The implementation of toArray() would be banal: > > jQuery.fn.toArray = function() { return Array.prototype.slice.apply > (this, arguments) }; > > or even: > > jQuery.fn.toArray = Array.prototype.slice; > > Thoughts? Am I disregarding something here? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
