Skip to content

Commit e7cdab2

Browse files
committed
first,end,eq
1 parent 0b514f5 commit e7cdab2

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Diff for: js/jing.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,24 @@
159159
return this.pushStack($.map(this, function(elem, i){
160160
return callback.call(elem, i, elem);
161161
}));
162+
},
163+
slice : function(){
164+
return this.pushStack(slice.apply(this, arguments));
165+
},
166+
first : function(){
167+
return this.eq(0);
168+
},
169+
last : function(){
170+
return this.eq(-1);
171+
},
172+
eq : function(i){
173+
var len = this.length,
174+
j = +i + (i < 0 ? len : 0);
175+
176+
return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
177+
},
178+
end : function(){
179+
return this.prevObject || this.constructor(null);
162180
}
163181
}
164182

@@ -1490,4 +1508,5 @@
14901508
// 2014-05-12 : 增加$().data(), $().removeData()方法
14911509
// 2014-05-13 : 增加$().event.dispatch方法
14921510
// 2014-05-14 : 增加$().CallBacks()方法
1493-
// 2014-05-15 : 增加$().queue()方法
1511+
// 2014-05-15 : 增加$().queue()方法
1512+
// 2014-05-16 : 增加$().first,end,eq,last方法

0 commit comments

Comments
 (0)