Ticket #136 (assigned enhancement)

Opened 4 years ago

Last modified 2 years ago

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. :)

Change History

comment:1 Changed 4 years ago by jf.hovinne

  • Status changed from new to assigned
  • Milestone set to 0.6

Right - will be implemented in 0.6.

comment:2 Changed 2 years ago by mr_lundis

  • Owner changed from jf.hovinne to mr_lundis
  • Status changed from assigned to new

comment:3 Changed 2 years ago by mr_lundis

  • Status changed from new to assigned

comment:4 Changed 2 years ago by mr_lundis

  • Milestone changed from 2.0 to 1.x
Note: See TracTickets for help on using tickets.