2

The official jQuery resource seems to indicate that you create a static method for your plugin using $.fn.plugin.staticMethod but that means that your public API requires calling $.fn.plugin.staticMethod(), which I find cumbersome.

Is there anything wrong with defining $.fn.plugin for your plugin and $.plugin.staticMethod for your static method, and what's the difference?

Further, what's the difference between:

$.extend({
  plugin : {
    staticMethod : function(){ }
  }
});

and

$.plugin = {
  staticMethod : function(){ }
};
Tom Auger
  • 19,421
  • 22
  • 81
  • 104
  • Duplicate? `jQuery.fn === jQuery.prototype` http://stackoverflow.com/questions/4083351/what-does-jquery-fn-mean – Derek 朕會功夫 Mar 08 '14 at 00:33
  • 1
    The link you provided was helpful, but I don't think it answers the entire question, which also deals with creating a static method. – Tom Auger Mar 08 '14 at 00:44

0 Answers0