[whatwg/url] `URLSearchParams.set()` accepts an array as value in Firefox & Chrome but it's nowhere documented (Issue #833)

### What is the issue with the URL Standard?

As the title says, Firefox 129 and Chrome 124 seem to support set()ting a query parameter to a list of values:

```
const url = new URL('https://www.example.com');
url.searchParams.set('param', ['foo', 'bar', 'baz']);
console.log(url.toString()); // https://www.example.com/?param=foo%2Cbar%2Cbaz
```

However, I can't find anything about this feature – neither on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/set) nor on the [Chrome Developer blog](https://developer.chrome.com/blog/urlsearchparams/), nor in the [spec](https://url.spec.whatwg.org/#dom-urlsearchparams-set). Moreover, TypeScript's lib.dom.d.ts [defines the signature of set() as](https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts#L22410)

```
set(name: string, value: string): void;
```

How come this is not documented anywhere? I suppose this is not an official feature? What other browsers support this (and if so, which versions)? Would it make sense to add it to the spec?


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/833
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/833@github.com>

Received on Friday, 23 August 2024 09:31:08 UTC