Skip to content
Browse files

Added .prevAll() and .nextAll() functionality.

  • Loading branch information...
1 parent b59c94d commit 052aa1445a780f69576a800836be73b57b62a909 @jeresig jeresig committed Sep 9, 2007
Showing with 6 additions and 4 deletions.
  1. +3 −1 src/core.js
  2. +3 −3 src/selector.js
View
4 src/core.js
@@ -1014,9 +1014,11 @@ jQuery.extend({
jQuery.each({
parent: "a.parentNode",
- parents: "jQuery.parents(a)",
+ parents: "jQuery.dir(a,'parentNode')",
next: "jQuery.nth(a,2,'nextSibling')",
prev: "jQuery.nth(a,2,'previousSibling')",
+ nextAll: "jQuery.dir(a,'nextSibling')",
+ prevtAll: "jQuery.dir(a,'previousSibling')",
siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
children: "jQuery.sibling(a.firstChild)",
contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
View
6 src/selector.js
@@ -400,12 +400,12 @@ jQuery.extend({
return { r: r, t: t };
},
- parents: function( elem ){
+ dir: function( elem, dir ){
var matched = [];
- var cur = elem.parentNode;
+ var cur = elem[dir];
while ( cur && cur != document ) {
matched.push( cur );
- cur = cur.parentNode;
+ cur = cur[dir];
}
return matched;
},

0 comments on commit 052aa14

Please sign in to comment.
Something went wrong with that request. Please try again.