> > Authoring guidelines say "Always use jQuery instead of $ 
> > inside your plugin code - that allows users to change the
> > alias for jQuery in a single place." Does this mean only
> > the first line jQuery.fn... or should also extend be
> > jQuery.extend()?

> That means everywhere inside. So if you did $.extend() you should do
> jQuery.extend() instead.

I like coding with $ too much to give it up, so I do this:

   (function( $ ) {
      // Plugin code goes here. You can use $ instead
      // of jQuery, and you can use var to declare
      // private variables.
   })( jQuery );

As often as not I need some private data for the plugin anyway, so the
closure gives me that and lets me rename jQuery to $ at the same time. Very
convenient.

-Mike


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to