Plugins that need to use a selector should have the caller pass in the selector as part of the plugin's arguments during initialization.
Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as $.fn.foo = function( selector, options ) { /* plugin code goes here */ }
, and the person using the plugin would write $( "div.bar" ).foo( "div.bar", {dog: "bark"} )
with the "div.bar"
selector repeated as the first argument of .foo()
.