- From: jakub-g <notifications@github.com>
- Date: Thu, 04 Feb 2016 07:33:58 -0800
- To: whatwg/url <url@noreply.github.com>
Received on Thursday, 4 February 2016 15:34:41 UTC
(not sure if this is the best place to put this)
Looking at the spec and test they don't explicitly mention anything about leading `?`
https://url.spec.whatwg.org/#interface-urlsearchparams
https://github.com/w3c/web-platform-tests/blob/master/url/urlsearchparams-get.html
In the current Firefox stable implementation this happens:
`new URLSearchParams('a=1&b=2').get('a') == 1`
`new URLSearchParams('?a=1&b=2').get('a') == null`
`new URLSearchParams('?a=1&b=2').get('?a') == 1`
IMO it would be good to skip leading `?` if present and return this instead
`new URLSearchParams('?a=1&b=2').get('a') == 1`
`new URLSearchParams('?a=1&b=2').get('?a') == null`
The reason is that `window.location.search` returns `?a=1&b=2` with leading `?`.
For consistency the URLSearchParams constructor should allow the leading `?`.
What do you think?
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/81
Received on Thursday, 4 February 2016 15:34:41 UTC