diff --git a/url.bs b/url.bs index 044f23f6..13d394be 100644 --- a/url.bs +++ b/url.bs @@ -2704,7 +2704,7 @@ steps:
-[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.
Let query be a new {{URLSearchParams}} object. -
If init is a string, set query's - list to the result of - parsing init. +
If init is a sequence, then for each pair in init: -
If init is a {{URLSearchParams}} object, set query's - list to a copy of init's +
+ +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. +
Otherwise, init is a string, then set query's + list to the result of + parsing init. +
Return query.