jQuery本身的二个静态方法jQuery.data()和jQuery.removeData(),jQuery.fn.data()/jQuery.fn.removeData()都是调用这二个方法对jquery对象中所有匹配的DOM元素进行操作:
jquery-1.4.2 css部分源码分析
CSS 相关的jQuery方法官方文档如下所列,各方法逐一分析:
.addClass()
Adds the specified class(es) to each of the set of matched elements.
.css()
Get the value of a style property for the first element in the set of matched elements.
.hasClass()
Determine whether any of the matched elements are assigned the given class.
.removeClass()
Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
.toggleClass()
Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
addClass方法除传入一个新的class名为参数外,还在1.4版本中,新加了一个可接收function为参数的addClass:
jquery debug plugin
自己使用的javascript debug插件源码:
jquery-1.4.2 core部分源码分析
jQuery()方法,这其实是jQuery构造方法的封装,在new关键词漏写时也是正确的返回jquery对象的,看后面关于jQuery.fn.init构造方法说明:
jquery-1.4.2 attribute部分源码分析
jQuery.fn.attr方法: