Ticket #136 (assigned enhancement)
Use a custom alias for jQuery
Reported by: | dtetto | Owned by: | mr_lundis |
---|---|---|---|
Priority: | minor | Milestone: | 1.x |
Component: | editor | Version: | trunk |
Keywords: | plugin,alias,jquery | Cc: |
Description
While the plugin correctly avoids overwriting/assuming the $ variable, it would be wonderful if the plugin used a custom alias (via closure), which would help it run in a high-conflict environment.
http://docs.jquery.com/Plugins/Authoring#Custom_Alias_in_plugin_code
As described, wrapping the plugin in
(function($) { // plugin definition })(jQuery);
seems to be the best practice in jQuery plugin development (note that the official jQuery UI plugins do this). This allows the function to run in environments where the jQuery variable can't always be assumed (i.e. after WYMeditor's initialization, the variable "jQuery" may be deleted, overwritten, or renamed.)
This is a small and simple change that would save me from having to manually do it to each WYM release, and being able to change all current instances of "jQuery" to "$" would be a tiny size optimization, too. :)
Right - will be implemented in 0.6.