隨筆 - 12, 文章 - 0, 評(píng)論 - 22, 引用 - 0
          數(shù)據(jù)加載中……

          jQuery分析紀(jì)要

                 本文是對(duì)jQuery源碼分析的簡(jiǎn)單紀(jì)要。

          jQuery相關(guān)對(duì)象內(nèi)存圖



              jQuery代碼分析紀(jì)要:
                  1、 jQuery一加載進(jìn)來(lái),就執(zhí)行匿名函數(shù),進(jìn)行jQuery的初始化工作,定義jQuery的功能,最后暴露出jQuery和$變量給用戶(hù)使用。
          (function( window, undefined ) {

          window.jQuery = window.$ = jQuery
          })( window );

                  2、 jQuery功能擴(kuò)展函數(shù)Extend
          jQuery.extend = jQuery.fn.extend = function() {
              
          }
                  jQuery提供了2個(gè)供用戶(hù)擴(kuò)展的函數(shù)jQuery.extend和jQuery.fn.extend。
                  jQuery.extend 用于擴(kuò)展jQuery自身方法,如jQuery.ajax, jQuery.getJSON等,jQuery.fn.extend則是用于擴(kuò)展jQuery(...)的方法,從上面的內(nèi)存圖中可以看出,經(jīng)過(guò)jQuery包裝后的dom元素,在其原型鏈上會(huì)擁有jQuery.fn.extend擴(kuò)展的方法。

                  3、 jQuery函數(shù),就是我們平常$('#id')所執(zhí)行的函數(shù),返回包裝過(guò)的dom元素
             // Define a local copy of jQuery
              jQuery = function( selector, context ) {
                  // The jQuery object is actually just the init constructor 'enhanced'
                  return new jQuery.fn.init( selector, context, rootjQuery );
              },

          posted on 2013-10-29 20:18 heavensay 閱讀(407) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): web-front


          只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 桃园县| 苏尼特右旗| 竹溪县| 晋江市| 涪陵区| 革吉县| 连山| 同仁县| 宜黄县| 和林格尔县| 兴海县| 静海县| 三台县| 闵行区| 从化市| 侯马市| 尚志市| 老河口市| 昌平区| 海安县| 探索| 澄城县| 德昌县| 淮阳县| 沾化县| 玉山县| 高雄县| 尼勒克县| 白河县| 琼海市| 浦江县| 磴口县| 中西区| 沂源县| 香格里拉县| 舞阳县| 新闻| 浮梁县| 景洪市| 沈阳市| 咸宁市|