From 98d6bbfe7be5ad1e17b9acc4b1c0bfc2bb13dd80 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 12 Jan 2017 13:47:17 +0100 Subject: [PATCH] Add URLSearchParams.prototype.sort() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This method is added to increase cache hits when making requests. It’s opt-in as the order of code points in a URL’s query is significant by default. It’s up to applications to decide if name order is not significant for them. Tests: https://github.com/w3c/web-platform-tests/pull/4531. Fixes #26. --- url.bs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/url.bs b/url.bs index 2121a333..9b547e96 100644 --- a/url.bs +++ b/url.bs @@ -2765,6 +2765,9 @@ interface URLSearchParams { sequence<USVString> getAll(USVString name); boolean has(USVString name); void set(USVString name, USVString value); + + void sort(); + iterable<USVString, USVString>; stringifier; }; @@ -2843,6 +2846,11 @@ method, when invoked, must return the value of the first name-value pair whose n method, when invoked, must return the values of all name-value pairs whose name is name, in list, in list order, and the empty sequence otherwise. +

The +has(name) +method, when invoked, must return true if there is a name-value pair whose name is name +in list, and false otherwise. +

The set(name, value) method, when invoked, must run these steps: @@ -2858,10 +2866,19 @@ method, when invoked, must run these steps:

  • Run the update steps. -

    The -has(name) -method, when invoked, must return true if there is a name-value pair whose name is name -in list, and false otherwise. +


    + +

    The sort() method, when invoked, must run these +steps: + +

      +
    1. Lexicographically sort all name-value pairs, if any, by name, while preserving the relative + order between duplicate names, if any. + +

    2. Run the update steps. +

    + +

    The value pairs to iterate over are the list name-value pairs with the key being