summaryrefslogtreecommitdiff
path: root/lib/internal/url.js
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2017-07-24 11:52:53 +0800
committerTimothy Gu <timothygu99@gmail.com>2017-08-01 11:58:15 +0800
commit57630adf90a347b47315614a63b750d4838911ae (patch)
tree57b349d5ce6d28f44eaa3bff9c1604959681c286 /lib/internal/url.js
parent6e79076feeb04a18253c0dc623307523819142d3 (diff)
downloadandroid-node-v8-57630adf90a347b47315614a63b750d4838911ae.tar.gz
android-node-v8-57630adf90a347b47315614a63b750d4838911ae.tar.bz2
android-node-v8-57630adf90a347b47315614a63b750d4838911ae.zip
url: update sort() behavior with no params
PR-URL: https://github.com/nodejs/node/pull/14185 Refs: https://github.com/whatwg/url/pull/336 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r--lib/internal/url.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 6048777cfd..95b5e9c5fd 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1076,12 +1076,11 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
sort() {
const a = this[searchParams];
const len = a.length;
- if (len <= 2) {
- return;
- }
- // arbitrary number found through testing
- if (len < 100) {
+ if (len <= 2) {
+ // Nothing needs to be done.
+ } else if (len < 100) {
+ // 100 is found through testing.
// Simple stable in-place insertion sort
// Derived from v8/src/js/array.js
for (var i = 2; i < len; i += 2) {