一行一行分析JQ源码学习笔记-04

jquery添加方法和属性

jquery.fn=jquery.prototype ={

jquery版本  

}

construtor  指向修正

js源码中 

fun  aaa(){}

会自动生成一句   aaa.prototype.constructor = aaa ;

容易被修改所以需要修正

aaa.prototype= {

    name:"hello",

    age:"20",

}

aaa.prototype= {

   aaa.constructor :aaa;

    name:"hello",

    age:"20",

}

init()

$("li")选择所以li

1.首先排除 $(null)   $(undefined)   走if  直接 return this (this指对象)

2.判断字符串

3.判断Dom元素

4. init作用之一 创建标签  选择 id  class

原文地址:https://www.cnblogs.com/h5monkey/p/5866853.html