您的位置:首页 > Web前端 > JQuery

jquery 2.0.3 源码学习笔记(二)

2016-12-18 00:00 357 查看
一、为啥不推荐使用"use strict"
1、兼容性问题,低版本浏览器不支持

二、jQuery(document)为啥赋值给rootjQuery
1、方便压缩
2、便于阅读,可维护

三、typeof undefined
1、兼容旧版本浏览器

四、class2type作用
1、$.type() 检测obj的数据类型。

五、jQuery对象的隐式初始化
1、一般的对象初始化
function A(){
}
A.prototype.init =function(){};
A.prototype.css= function(){};
var a=new A();
a.init()
a.css();

2、jQuery的对象初始化
function jQuery() {
return new jQuery.prototype.init();
}
jQuery.prototype.init=function(){};
jQuery.prototype.css=function(){};
jQuery.prototype.init.prototype=jQuery.prototype;

jQuery().css();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: