首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

jQuery源码历代记五

2012-10-24 
jQuery源码历代记5?之前文章传送门:http://adamed.iteye.com/category/207898?下面要介绍的jQuery构造器中

jQuery源码历代记5

?

之前文章传送门:http://adamed.iteye.com/category/207898

?

下面要介绍的jQuery构造器中的方法是入栈、出栈方法:

?他们分别是pushStack和end。

先看下putStack的API描述

.pushStack( elements )

elements? An array of elements to push onto the stack and make into a new jQuery object.?

?

?

pushStack : function( a , args ) {    //这里a为数组:['<em>aaa</em>','<em>aaa</em>']    //这里的args为:'em'    var fn = args && args[args.length - 1];    //这里的fn为'em'    if ( !fn || fn.constructor != Function ) {    //fn符合此判断        if ( !this.stack ) this.stack = [ ];        //将原结果集3个p元素存放至this.stack        this.stack.push( this.get() );        //将结果集更新为2个新em元素的内容        this.get( a );    }}
?

//**********************这是分隔符********************************

我们下面用大量的篇幅阐述一下jQuery.find的源码~~?

?

未完待续~~~

?

1 楼 zhangwenzhuo 2012-04-02   为什么this.get()会返回本身的呢?
2 楼 adamed 2012-04-05   zhangwenzhuo 写道为什么this.get()会返回本身的呢?


源码历代记1里最后说了

热点排行