jQuery
jQuery copied to clipboard
jQuery2.0.3源码分析笔记
前言
这里加入了很多对于原生JavaScript
的理解,忽略了Sizzle
选择器(它可以单独抽离出来使用Sizzle.js
框架)的源码分析,同时由于13.事件操作
源码相对比较复杂,只是粗略的进行了源码的调试和说明,对于Jquery
如何监听事件以及取消监听的原理,代码执行顺序和兼容性问题处理有了粗略理解,后续有空会继续深入分析源码的实现原理.
完整版
1. 总体架构
2.私有属性
-
rootjQuery
-
readyList
-
core_strundefined
-
window
-
_
-
class2type
-
core_deletedIds
-
core_version
- 数组、对象、字符串方法
-
jQuery
- 正则变量
-
fcamelCase
-
completed
3. jQuery对象的属性和方法
-
$().jquery
-
$().constructor
-
$().init()
- jQuery构造函数方法 -
$().selector
-
$().length
-
$().toArray()
-
$().get()
-
$().pushStack()
-
$().end()
-
$().slice()
-
$().each()
-
$().ready()
-
$().first()/last()/eq()
-
$().map()
-
$().push()/sort()/slice()
4. 拷贝继承
5. 工具方法
-
$.expando
-
$.noConflict
-
$.ready()
-
$.holdReady()
-
$.isFunction()
-
$.isArray()
-
$.isWindow()
-
$.isNumeric()
-
$.type()
-
$.isPlantObject()
-
$.isEmptyObject()
-
$.error()
-
$.parseHTML()
-
$.parseJSON()
-
$.parseXML()
-
$.noop()
-
$.globalEval()
-
$.camelCase()
-
$.nodeName()
-
$.each()
-
$.trim()
-
$.makeArray()
-
$.inArray()
-
$.merge()
-
$.grep()
-
$.map()
-
$.guid
-
$.proxy()
-
$.access()
-
$.now()
-
$.swap()
6. 选择器Sizzle
忽略了Sizzle选择器(它可以单独抽离出来使用Sizzle.js框架)的源码分析。
7. 回调对象
-
options
-
$.Callback().add()
-
$.Callback().remove()
-
$.Callback().has()
-
$.Callback().fire()/firewith()/fire()
- other API