diff --git a/url.bs b/url.bs index 044f23f6..13d394be 100644 --- a/url.bs +++ b/url.bs @@ -2704,7 +2704,7 @@ steps:

Interface {{URLSearchParams}}

-[Constructor(optional (USVString or URLSearchParams) init = ""),
+[Constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = ""),
  Exposed=(Window,Worker)]
 interface URLSearchParams {
   void append(USVString name, USVString value);
@@ -2718,6 +2718,14 @@ interface URLSearchParams {
 };
 
+
+

Constructing and stringifying a {{URLSearchParams}} object is fairly straightforward: + +


+let params = new URLSearchParams({key: 730d67})
+params.toString() // key=730d67
+
+

A {{URLSearchParams}} object has an associated list of name-value pairs, which is initially empty. @@ -2732,14 +2740,25 @@ initially null.

  1. Let query be a new {{URLSearchParams}} object. -

  2. If init is a string, set query's - list to the result of - parsing init. +

  3. +

    If init is a sequence, then for each pair in init: -

  4. If init is a {{URLSearchParams}} object, set query's - list to a copy of init's +

      +
    1. If pair does not contain exactly two items, then throw a {{TypeError}}. + +

    2. Append a new name-value pair whose name is pair's first item, and value is + pair's second item, to query's list. +

    + +
  5. Otherwise, if init is a record, then for each mapping + (name, value) in init, append a new name-value pair whose name is + name and value is value, to query's list. +

  6. Otherwise, init is a string, then set query's + list to the result of + parsing init. +

  7. Return query.

@@ -2885,6 +2904,7 @@ James Ross, Joshua Bell, Jxck, Kevin Grandon, +Kornel LesiƄski, Larry Masinter, Leif Halvard Silli, Mark Davis,