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:36:48 -0400
commit7c72f69ed0b1185c49b9005e749c3b974c4ad260 (patch)
treee1495b25af61947a2b951b369a88b94fb4fadeb6
parenta49693a5272b5cd501c14c2e02aeb5568ceb65a0 (diff)
downloadjquery-7c72f69ed0b1185c49b9005e749c3b974c4ad260.tar.gz
jquery-7c72f69ed0b1185c49b9005e749c3b974c4ad260.zip
Fix #13846: .prev sort direction
(cherry picked from commit 9c4a428528cc47b0ef87a273f191c0fbbccc9678)
-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 c1798a44f..2f649988d 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({
ret = jQuery.unique( ret );
}
- // Reverse order for parents* and prev*
- if ( name.charAt(0) === "p" && name !== "parent" ) {
+ // Reverse order for parents* and prev-derivatives
+ if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index a622ba902..292cb41b9 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,