On Jan 25, 9:16 am, immakiku
<immak...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> http://www.prototypejs.org/api/class/create
>
> Try running that in Firefox. It''ll only hiss twice. Firefox gives:
> "this._each is not a function" line 592 of prototype.js
Updated the docs. Thanks!
> My second question is, why does this script work? It overwrote
> Enumerable''s initialize method, so how do the elements get added?
Enumerable doesn''t have an initialize method; it''s a mixin,
not a
class. In other words, you can''t instantiate Enumerable on its own;
it''s simply a bundle of useful methods for enumerating. It only has
value in a specific context (like Array, or Hash, or a collection of
your own creation).
In Prototype, "mixins" are plain objects. Even though the commonest
use case for extra Class.create arguments involves inheriting from
another class, you can also pass in an ordinary object to add that
object''s properties to the class (in a manner similar to that of
Object.extend).
Hope that made sense.
Cheers,
Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---