What is the Prototype syntax for looping through all arguments in a function? Is it arguments.each() or something? The reason I ask is because I''d like to loop through all args in a function and apply the encodeURIComponent()<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:encodeURIComponent>( 1<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:encodeURIComponent>, 2 <http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object>) when submitting an Ajax post of text fields, in order to make sure to escape out of all special chars, etc. thanks for any heads up and cheers, Mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.prototypejs.org/api/enumerable/collect On 5/21/07, Mark Holton <holtonma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What is the Prototype syntax for looping through all arguments in a > function? Is it arguments.each() or something? > > The reason I ask is because I''d like to loop through all args in a function > and apply the encodeURIComponent() (1, 2) when submitting an Ajax post of > text fields, in order to make sure to escape out of all special chars, etc. > > thanks for any heads up and cheers, > Mark > > > > > >-- Jesse E.I. Farmer e: jesse-h8Qh2m8E5SHQT0dZR+AlfA@public.gmane.org w: http://20bits.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Awesome ...knew it had to exist. This link has some added goodies too. Many thanks! On 5/21/07, Jesse Farmer <farmerje-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > http://www.prototypejs.org/api/enumerable/collect > > On 5/21/07, Mark Holton <holtonma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > What is the Prototype syntax for looping through all arguments in a > > function? Is it arguments.each() or something? > > > > The reason I ask is because I''d like to loop through all args in a > function > > and apply the encodeURIComponent() (1, 2) when submitting an Ajax post > of > > text fields, in order to make sure to escape out of all special chars, > etc. > > > > thanks for any heads up and cheers, > > Mark > > > > > > > > > > > > > > -- > Jesse E.I. Farmer > e: jesse-h8Qh2m8E5SHQT0dZR+AlfA@public.gmane.org > w: http://20bits.com > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Holton a écrit :> What is the Prototype syntax for looping through all arguments in a > function? Is it arguments.each() or something?arguments is array-like, so you can go with a custom loop: for (var index = 0, l = arguments.length; index < l; ++index) // code using arguments[index] If you wish to go with Array/Enumerable, use the $A conversion: $A(arguments) ''HTH -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---