价值,原型和特性的差异
好!首先,这个问题来自于一个在jQuery宇宙中挖得太深(很可能迷路)的人。
在我的研究中,我发现了jquery的主要模式是这样的(如果需要更正的话):
(function (window, undefined) {
   jQuery = function (arg) {
      // The jQuery object is actually just the init constructor 'enhanced'
      return new jQuery.fn.init(arg);
   },
   jQuery.fn = jQuery.prototype = {
      constructor: jQuery,
      init: function (selector, context, rootjQuery) {
         // get the selected DOM el.
         // and returns an array
      },
      method: function () {
         doSomeThing();
         return this;
      },
      method2: function () {
         doSomeThing();
         return this;,
         method3: function () {
            doSomeThing();
            return this;
         };
         jQuery.fn.init.prototype = jQuery.fn;
         jQuery.extend = jQuery.fn.extend = function () {
            //defines the extend method 
         };
         // extends the jQuery function and adds some static methods 
         jQuery.extend({
            method: function () {}
         })
      })当$启动时,jQuery.prototype.init启动并返回一个元素数组。但我不明白它是如何增加了jQuery的方法类似.css或.hide等。到这个数组。
我得到了静态方法。但是用所有这些方法都无法获得返回值和元素数组的方式。
HUH函数
红糖糍粑
相关分类