SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 16:01 UTC
Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Hello, just posted on trac. sorry for duplication. I started using prototype.js for the first time. Excuse my amateurness i cant seem to figure this one out. With prototype.js included in doc It affects my previous JS code. Now JS Variables which were defined by the value of a function, have instead adopted the function method. So when i output the variable it prints out the function content... But this does not happen all the time. and i;ve had trouble recreating a simple example to blog. E.g. This is sort of an example... this will work. var name = print(); function print() { return "print"; } alert( "print" ); // output: // ------------ // print However in my script it would output the whole function like. . // output: // ------------ // function print(){ return "print";} I presume this is a novice error. Thankyou A --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 17:06 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Solved it. prototype added Objects to my arrays buggering up any for.. in .. loops. Is prototype more a good library?... honestly? A On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, just posted on trac. sorry for duplication. > > I started using prototype.js for the first time. Excuse my amateurness > i cant seem to figure this one out. > > With prototype.js included in doc It affects my previous JS code. Now > JS Variables which were defined by the value of a function, have > instead adopted the function method. So when i output the variable it > prints out the function content... But this does not happen all the > time. and i;ve had trouble recreating a simple example to blog. > > E.g. This is sort of an example... this will work. > > var name = print(); > > function print() > { > return "print"; > > } > > alert( "print" ); > > // output: > // ------------ > // print > > However in my script it would output the whole function like. > . > // output: > // ------------ > // function print(){ return "print";} > > I presume this is a novice error. > > Thankyou A--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 17:06 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Solved it. prototype added Objects to my arrays buggering up any for.. in .. loops. Is prototype more a good library?... honestly? A On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, just posted on trac. sorry for duplication. > > I started using prototype.js for the first time. Excuse my amateurness > i cant seem to figure this one out. > > With prototype.js included in doc It affects my previous JS code. Now > JS Variables which were defined by the value of a function, have > instead adopted the function method. So when i output the variable it > prints out the function content... But this does not happen all the > time. and i;ve had trouble recreating a simple example to blog. > > E.g. This is sort of an example... this will work. > > var name = print(); > > function print() > { > return "print"; > > } > > alert( "print" ); > > // output: > // ------------ > // print > > However in my script it would output the whole function like. > . > // output: > // ------------ > // function print(){ return "print";} > > I presume this is a novice error. > > Thankyou A--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 17:06 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Solved it. prototype added Objects to my arrays buggering up any for.. in .. loops. Is prototype more a good library?... honestly? A On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, just posted on trac. sorry for duplication. > > I started using prototype.js for the first time. Excuse my amateurness > i cant seem to figure this one out. > > With prototype.js included in doc It affects my previous JS code. Now > JS Variables which were defined by the value of a function, have > instead adopted the function method. So when i output the variable it > prints out the function content... But this does not happen all the > time. and i;ve had trouble recreating a simple example to blog. > > E.g. This is sort of an example... this will work. > > var name = print(); > > function print() > { > return "print"; > > } > > alert( "print" ); > > // output: > // ------------ > // print > > However in my script it would output the whole function like. > . > // output: > // ------------ > // function print(){ return "print";} > > I presume this is a novice error. > > Thankyou A--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 17:06 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Solved it. prototype added Objects to my arrays buggering up any for.. in .. loops. Is prototype more a good library?... honestly? A On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, just posted on trac. sorry for duplication. > > I started using prototype.js for the first time. Excuse my amateurness > i cant seem to figure this one out. > > With prototype.js included in doc It affects my previous JS code. Now > JS Variables which were defined by the value of a function, have > instead adopted the function method. So when i output the variable it > prints out the function content... But this does not happen all the > time. and i;ve had trouble recreating a simple example to blog. > > E.g. This is sort of an example... this will work. > > var name = print(); > > function print() > { > return "print"; > > } > > alert( "print" ); > > // output: > // ------------ > // print > > However in my script it would output the whole function like. > . > // output: > // ------------ > // function print(){ return "print";} > > I presume this is a novice error. > > Thankyou A--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-May-23 17:13 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Well, asking a group dedicated to helping others learn and use prototype whether or not prototype is a good library is going to get you a biased answer: of course it''s a good library. The thing I like best about it is that prototype alone has nothing to do with fancy effects, transitions, drag/drop, etc. Instead, prototype focuses on enhancing javascript and facilitating AJAX and lets scriptaculous worry about the effects. Since I need the former far more often than the latter, prototype is better for me than the other libraries which always come with both. - Dash - SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Solved it. > > prototype added Objects to my arrays buggering up any for.. in .. > loops. > > Is prototype more a good library?... honestly? > > A > > > > > On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hello, just posted on trac. sorry for duplication. >> >> I started using prototype.js for the first time. Excuse my amateurness >> i cant seem to figure this one out. >> >> With prototype.js included in doc It affects my previous JS code. Now >> JS Variables which were defined by the value of a function, have >> instead adopted the function method. So when i output the variable it >> prints out the function content... But this does not happen all the >> time. and i;ve had trouble recreating a simple example to blog. >> >> E.g. This is sort of an example... this will work. >> >> var name = print(); >> >> function print() >> { >> return "print"; >> >> } >> >> alert( "print" ); >> >> // output: >> // ------------ >> // print >> >> However in my script it would output the whole function like. >> . >> // output: >> // ------------ >> // function print(){ return "print";} >> >> I presume this is a novice error. >> >> Thankyou A >> > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 17:43 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Solved it. prototype added Objects to my arrays buggering up any for.. in .. loops. Is prototype more a good library?... honestly? A On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, just posted on trac. sorry for duplication. > > I started using prototype.js for the first time. Excuse my amateurness > i cant seem to figure this one out. > > With prototype.js included in doc It affects my previous JS code. Now > JS Variables which were defined by the value of a function, have > instead adopted the function method. So when i output the variable it > prints out the function content... But this does not happen all the > time. and i;ve had trouble recreating a simple example to blog. > > E.g. This is sort of an example... this will work. > > var name = print(); > > function print() > { > return "print"; > > } > > alert( "print" ); > > // output: > // ------------ > // print > > However in my script it would output the whole function like. > . > // output: > // ------------ > // function print(){ return "print";} > > I presume this is a novice error. > > Thankyou A--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
SonOfDod-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-23 18:10 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
Thanks for your thoughts. I''ve got another bug. ( apart from the duplicate posts here ) I''''m creating new DOM objects and then calling the AutoComplete scriptaculous class. It immediatly throws the error. "Element.extend is not a function" line 1253 prototype.js version 1.5.1, Firefox. Cheers .. May 23, 6:13 pm, David Dashifen Kees <dashi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well, asking a group dedicated to helping others learn and use prototype > whether or not prototype is a good library is going to get you a biased > answer: of course it''s a good library. The thing I like best about it > is that prototype alone has nothing to do with fancy effects, > transitions, drag/drop, etc. Instead, prototype focuses on enhancing > javascript and facilitating AJAX and lets scriptaculous worry about the > effects. Since I need the former far more often than the latter, > prototype is better for me than the other libraries which always come > with both. > > - Dash - > > SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > Solved it. > > > prototype added Objects to my arrays buggering up any for.. in .. > > loops. > > > Is prototype more a good library?... honestly? > > > A > > > On May 23, 5:01 pm, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> Hello, just posted on trac. sorry for duplication. > > >> I started using prototype.js for the first time. Excuse my amateurness > >> i cant seem to figure this one out. > > >> With prototype.js included in doc It affects my previous JS code. Now > >> JS Variables which were defined by the value of a function, have > >> instead adopted the function method. So when i output the variable it > >> prints out the function content... But this does not happen all the > >> time. and i;ve had trouble recreating a simple example to blog. > > >> E.g. This is sort of an example... this will work. > > >> var name = print(); > > >> function print() > >> { > >> return "print"; > > >> } > > >> alert( "print" ); > > >> // output: > >> // ------------ > >> // print > > >> However in my script it would output the whole function like. > >> . > >> // output: > >> // ------------ > >> // function print(){ return "print";} > > >> I presume this is a novice error. > > >> Thankyou A--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
RobG
2007-May-24 03:19 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
On May 24, 3:06 am, "SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <SonOf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Solved it. > > prototype added Objects to my arrays buggering up any for.. in .. > loops. > > Is prototype more a good library?... honestly?Once upon a time, Prototype.js extended Object too, but fortunately its authors saw the light. Other libraries, such as jQuery, use name spaces to extend array functionality without extending the built-in Array object. The only time for..in should be used with Array is for (very) sparse arrays to save time when iterating over its elements. Otherwise, you are using an Array when you probably should be using an Object. -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
tobie
2007-May-24 03:53 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
> The only time for..in should be used with Array is for (very) sparse > arrays to save time when iterating over its elements.for...in is way slower than the regular for(var i = 0, len array.length; i < len; i++) for..in should NEVER be used over arrays except to do what it''s meant to: iterate over properties. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
RobG
2007-May-24 13:22 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
On May 24, 1:53 pm, tobie <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The only time for..in should be used with Array is for (very) sparse > > arrays to save time when iterating over its elements. > > for...in is way slower than the regular for(var i = 0, len > array.length; i < len; i++)Except when used in (very) sparse arrays...> for..in should NEVER be used over arrays except to do what it''s meantThere''s an old saying: never say never ;-)> to: iterate over properties.The indices of an array *are* properties. -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
tobie
2007-May-24 16:31 UTC
Re: Prototype.js: var myvar = myfunct(); Returns the sourceof myfunc() instead of returning the value. Help!
> There''s an old saying: never say never ;-)I agree... but it''s like eval: reserved to cases where you really know what you are doing.> The indices of an array *are* properties.Sure, but so are - legitimately - the properties attached to Array''s prototype. -- Tobie --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---