On Oct 3, 9:27 am, "John Resig" <[EMAIL PROTECTED]> wrote:
> At the Ajax Experience we talked about possibly making a reusable function
> for helping to encapsulate much of the functionality commonly seen in jQuery
> plugins.

Would this extra code go in the core?

What advantage does this have over just creating a good template/
pattern for plugins? I could see that by abstracting it you could get
all plugins to register themselves and function in the same way. But
I'm not sure that you could provide enough functionality to satisfy
the needs of any plugins with enough complexity.

I'm just about finished with my ContextMenu plugin, which I developed
from a pattern that I find useful and reusable, and it works well for
me.

For simple additions to jQuery that I have built up over time, I've
been using a very simple plugin that lets me avoid the internal
looping over each matched item:

$.plugin = function(name,f) {
        $.fn[name] = function() {
                var args = arguments;
                return this.each(function() {
                        f.apply(this,args);
                });
        }
}
$.plugin("alert", function(){ alert(this.innerHTML); } );

Similar to what you've written, I guess, but simpler and with less
functionality.

Matt Kruse

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" 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-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to