aboutsummaryrefslogtreecommitdiffstats
path: root/src/selector
diff options
context:
space:
mode:
authorBruno PIERRE <brunopierre4@yahoo.fr>2022-01-24 18:55:16 +0100
committerGitHub <noreply@github.com>2022-01-24 18:55:16 +0100
commit9c6f64c7b51d50e334ef1183e2937ad77c0a68b0 (patch)
tree769a1b64a6760c6e21831d5f4b35d3a610e37162 /src/selector
parenteb9ceb2facbeff1c66a41824bd0ac0c56d0c5c62 (diff)
downloadjquery-9c6f64c7b51d50e334ef1183e2937ad77c0a68b0.tar.gz
jquery-9c6f64c7b51d50e334ef1183e2937ad77c0a68b0.zip
Core: Don't rely on splice being present on input
Without this fix calling `jQuery.uniqueSort` on an array-like can result in: TypeError: results.splice is not a function at Function.jQuery.uniqueSort (https://code.jquery.com/jquery-git.js:664:12) at jQuery.fn.init.find (https://code.jquery.com/jquery-git.js:2394:27) at gocusihafe.js:3:4 Closes gh-4986
Diffstat (limited to 'src/selector')
-rw-r--r--src/selector/uniqueSort.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/selector/uniqueSort.js b/src/selector/uniqueSort.js
index 127cc7068..e9438485c 100644
--- a/src/selector/uniqueSort.js
+++ b/src/selector/uniqueSort.js
@@ -1,6 +1,7 @@
import jQuery from "../core.js";
import document from "../var/document.js";
import sort from "../var/sort.js";
+import splice from "../var/splice.js";
var hasDuplicate;
@@ -80,7 +81,7 @@ jQuery.uniqueSort = function( results ) {
}
}
while ( j-- ) {
- results.splice( duplicates[ j ], 1 );
+ splice.call( results, duplicates[ j ], 1 );
}
}