Re: [whatwg/url] Proposal: URL.setSearchParams() (Issue #828)

I'm confused by this feature request, and in particular why the `search` setter doesn't work today.

Given this code:

```js
const usp = new URLSearchParams("foo=bar");
const url = new URL("https://example.com/");
url.search = usp;
```

you get the desired result: `url` is modified to have `foo=bar` search params.

The section "What solutions exist today?" in the OP seems to be implying this isn't good enough. But I can't understand exactly when.

Can you give a concrete example of a `URLSearchParams` object such that assigning `url.search = usp` gives the wrong result? And such that setting `url.searchParams = usp`, using a hypothetical future setter, would give a better result?

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

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

Received on Friday, 24 May 2024 03:05:49 UTC