]> source.dussan.org Git - jquery.git/commitdiff
Added .prevAll() and .nextAll() functionality.
authorJohn Resig <jeresig@gmail.com>
Sun, 9 Sep 2007 21:34:37 +0000 (21:34 +0000)
committerJohn Resig <jeresig@gmail.com>
Sun, 9 Sep 2007 21:34:37 +0000 (21:34 +0000)
src/core.js
src/selector.js

index 67cb147c774e03e61a7088075f81b8e4bdeb3442..bedafdce2fb93e769aaad449406a9ab096b139cd 100644 (file)
@@ -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)"
index 0dadeb4535e2ce1a610acd83eb40dfa0e162a209..1fbbe9be6660bf0b30f39fce5c5788bfd7116ee2 100644 (file)
@@ -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;
        },