Matt Foster wrote:
> Hey There,
>
>         You're certainly on to something there, the amount of plugins
> and community support for jQuery dwarfs our efforts with prototype.
> That isn't to say it doesn't exist, just unfortunately not as strong,
> at the moment. I found this proof in the number of components
> contributed to ajaxrain where jquery has some 4X more than
> prototype.   I also agree completely with unified documentation,  I
> had created a Google CSE for all things prototype a while back which
> can certainly help you refine your search,
> http://positionabsolute.net/blog/2007/11/prototype-custom-search-engine.php
>
>         I believe prototype to be the stronger framework, as noted yes
> jQuery has some swift baked-in functionality that lets designers
> easily add JS behaviors and smooth effects but when it comes down to
> application development, my eggs are in prototype's basket.  The only
> way to change this situation is for us, the developers, to step up and
> contribute more to the community.
>
> Regards,
>            Matt
>   
One thing I've been working on is a patch to make Prototype more 
extensible and provide some documentation on extending Prototype 
Classes.  For example, I'm adding addMethods() methods to Class and 
Event.  I'm thinking this would allow Prototype to be more flexible in 
accepting plugins.  What do you think?

- Ken Snyder

var Class = {
  _cache: [],
 
  create: function() {...},
 
  addMethods: function(methods) {
    // classes declared in the future
    Object.extend(Class.Methods, methods);
    // previously declared classes
    Class._cache.each(function(klass) {
      Object.extend(klass, methods);
    });
  }
};

Object.extend(Event, (function() {
...  
    addMethods: function(methods) {
      Object.extend(Event.Methods, methods);
      Object.extend(Event, methods);
    }
  };
})());

// examples
Class.addMethods({
  // remind you of Prototype 1.3?
  extend: function(methods) {
    Object.extend(this, methods);
  },
  debug: function(property) {
    console.log(this[property]);
  }
});
// now every new object created from a Class.create() class will have 
these two methods.  It is similar to the original Prototype idea of 
Object.prototype.extend

Event.addMethods({
  within: function(event, element) {
    // deprecated but just for illustration
    return Position.within(element, Event.pointerX(event), 
Event.pointerY(event));
  }
});
// now every extended event will have an additional method 'within'


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to