labihua

jquery源码笔记

2015-05-25 19:19  厘澄  阅读(125)  评论(0编辑  收藏  举报

1、jquery初始化

function jQuery() {
    return new jQuery.prototype.init();
}

jQuery.prototype.init = function () {}
jQuery.prototype.css = function () {}

为啥链式运动可以直接调用呢?
jquer().css()
是因为
jquery增加了这一句:
function jQuery() {
    return new jQuery.prototype.init();
}

jQuery.prototype.init = function () {}
jQuery.prototype.css = function () {}
jQuery.ptotype.init.prototype = jQuery.prototype;
这样init的prototype就引用了jQuery.prototype

  

分类:

技术点:

相关文章:

  • 2021-11-17
  • 2021-06-20
  • 2022-03-08
  • 2021-10-14
  • 2021-05-20
  • 2021-07-08
  • 2022-01-29
  • 2021-11-16
猜你喜欢
  • 2021-07-06
  • 2021-06-23
  • 2021-12-25
  • 2021-04-10
  • 2021-05-22
  • 2021-09-03
  • 2022-02-28
相关资源
相似解决方案