aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2013-05-01 11:33:06 -0400
committerRichard Gibson <richard.gibson@gmail.com>2013-05-01 11:33:06 -0400
commit9c4a428528cc47b0ef87a273f191c0fbbccc9678 (patch)
treeeac2355f99c3a227b5c7d4479bff8cd4d2220b12
parent18cccd04a6f69018242bce96ef905bc5d3be6ff8 (diff)
downloadjquery-9c4a428528cc47b0ef87a273f191c0fbbccc9678.tar.gz
jquery-9c4a428528cc47b0ef87a273f191c0fbbccc9678.zip
Fix #13846: .prev sort direction
-rw-r--r--src/traversing.js5
-rw-r--r--test/unit/traversing.js2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 6f68e7821..b5a38f363 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -1,4 +1,5 @@
var isSimple = /^.[^:#\[\.,]*$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
@@ -200,8 +201,8 @@ jQuery.each({
jQuery.unique( matched );
}
- // Reverse order for parents* and prev*
- if ( name[ 0 ] === "p" && name !== "parent" ) {
+ // Reverse order for parents* and prev-derivatives
+ if ( rparentsprev.test( name ) ) {
matched.reverse();
}
}
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index b35a5c3cc..89ed81ac6 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -682,7 +682,7 @@ test("sort direction", function() {
parents: true,
parentsUntil: true,
next: false,
- prev: true,
+ prev: false,
nextAll: false,
prevAll: true,
nextUntil: false,