首页 > Web开发 > 详细

jquery-2.0.3 源码分析 整体架构

时间:2017-10-11 09:50:32      阅读:206      评论:0      收藏:0      [点我收藏+]

关键


  var jQuery = function( selector, context ) {
    return new jQuery.fn.init();
  }

  jQuery.fn = jQuery.prototype = {

    constructor: jQuery,

    name: ‘hello‘,

    init: function() {

      return this;

    }

  }

  jQuery.fn.init.prototype = jQuery.fn;

  var a = new jQuery();
  console.log( a.name )  //hello

 

扩展

jQuery.extend = jQuery.fn.extend = function() {

jQuery.extend 对jQuery本身的属性和方法进行了扩展 : 

jQuery.fn.extend 对jQuery.fn的属性和方法进行了扩展 : 

 

转载:

by Aaron:http://www.cnblogs.com/aaronjs/p/3278578.html

jquery-2.0.3 源码分析 整体架构

原文:http://www.cnblogs.com/liuyingde/p/7648691.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!