aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-05-07 16:05:05 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-05-07 16:05:05 -0400
commit2af3642cd5f968d64c40b83250e00e077b48c086 (patch)
tree4cc7cbcabe142fd5644eb0d780083484e8e4f556
parentfbee36be16e155cc1384f34a35b455c2413ea94d (diff)
downloadjquery-2af3642cd5f968d64c40b83250e00e077b48c086.tar.gz
jquery-2af3642cd5f968d64c40b83250e00e077b48c086.zip
Further reduce historical cruft. Removes the untested and unnec. jQuery.nth()
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
-rw-r--r--src/traversing.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 0b8a5f240..d2a8cd1b4 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -174,6 +174,17 @@ function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
+function nth( cur, dir ) {
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && num++ === 1 ) {
+ break;
+ }
+ }
+ return cur;
+}
+
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
@@ -186,10 +197,10 @@ jQuery.each({
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
- return jQuery.nth( elem, "nextSibling" );
+ return nth( elem, "nextSibling" );
},
prev: function( elem ) {
- return jQuery.nth( elem, "previousSibling" );
+ return nth( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
@@ -260,18 +271,6 @@ jQuery.extend({
return matched;
},
- nth: function( cur, dir ) {
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && num++ === 1 ) {
- break;
- }
- }
-
- return cur;
- },
-
sibling: function( n, elem ) {
var r = [];