This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Extending jQuery means the creation of plugins and add-ons. If you have used plugins, then you already know what the advantages are -- it allows jQuery core to concentrate on the things that most people need, and to allow the use of plugins for everything else.
Whats is different in using jQuery in our applications and creating plugin/addons using same? can a plugin itself be extendable? i.e; one more plugin can be created by extending this plugin-if at all it is possible . Can you brief me on what topics are covered in the book?
Now, a thought comes to mind in regards to this; When extending another plugin, I should think that versioning would become even more critical to making sure that things run exactly as expected, right? At that point you would have to keep track of both the version of jQuery as well as the version of the plugin you are extending.
"I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use."
-- Galileo Galilei
By "extending jQuery" I mean the writing of a section of code in the form of a plugin that can easily be reused on many pages. As Bear said, this lets jQuery concentrate on the functionality used by most people without bloating the library with rarely used abilities. The plugins integrate with fully into the normal jQuery processing and can take advantage of its other capabilities. The benefits of creating a plugin include consistency of appearance and behaviour across your Web site and reduced maintenance as there is only a single copy of the code to test and update.
You can extend existing plugins and override or add functionality to them - some more easily than others depending of how they are written. jQuery UI is designed to be extensible - most of its plugins extend its Widget module, or those that interact with mouse drags extend the Mouse module. You can enhance one of the jQuery UI widgets by using it as the basis for your new plugin.
Some plugins add their own internal extension points. For example, the Validation plugin lets you add new validation rules and class rules. My Calculator plugin lets you add new buttons/functions to it. However, these are isolated examples and each plugin does this its own way.
Versioning of plugins is always a problem - even just with jQuery itself. At least with jQuery and jQuery UI there is a built-in version number that you can check - $.fn.jquery and $.ui.version respectively. Most plugins don't provide this facility. Maybe this should be added to the list of best practices.