-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests and spec don't agree about base URL in match result inputs
#133
Comments
This was discussed in issues previously at: The intent was to make the |
Ah, missed that issue. Seems fine, although I do wonder why this |
Its a weak use case, but the idea was the user may want to pass the result on to other code to process and it may expect the same exact input for some other comparison/operation. This matches what Regexp.exec() does, etc. |
Ok - I could maybe see some value here, but it seems to me it wouldn't be much more difficult to just pass the inputs manually as user. I sorta had the expectation when I first saw the dictionary definition that these "inputs" are the normalized values, as this "plain passthrough" is not very common. |
Its not too late to change this. I'm just not sure which is better. @domenic do you have any thoughts here? |
This is a tough one. I'm afraid I can't be of much help as a tiebreaker; I see both sides. My only contribution is that I could see the |
@jeffpossnick do you have an opinion from a web developer point of view? |
I made a twitter poll as well: |
Looking at the poll, my opinion is obviously in the minority. I'd say let's keep behaviour like it is implemented in Chrome, and update the spec. Seems most people's expectations would be met. The normalized values are always available via the |
Someone on Twitter did bring up this point: https://twitter.com/bhathos/status/1435353793588350979. This shows that the expectation is that the matcher matches against whatever "result.input" is - that is however not the case. The matcher matches against the normalized value of I'm impartial now. |
The matcher also doesn't operate on the entire inputs array. It operates on individual component values after normalization. Those normalized inputs are available at As I wrote in the previous issue, though, it is all a bit weird and I'm not sure if there is a perfect answer. I think the current spec is the least bad approach, though. |
Final poll results:
I'm going to go ahead and update the spec to use the original raw value. |
Add original baseURL string to result.inputs. (Fixes #133)
As per spec, the second item in the
inputs
field of the match result should be the stringification of the parsed base urlURL
(it actually says to add theURL
object itself, but I'll just consider that a bug).For this test case, the stringification of the base url is 'https://example.com/".
Yet the test runner wants it to be
https://example.com
. This is the case in Chromium right now (it appends the URL string, not the stringification of the parsed url). See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/url_pattern/url_pattern.cc;l=496-497;drc=1a1342c1f2d295948d79211cd860721732990ed8I would say that the spec behaviour actually makes more sense, and that the test should be fixed to look like this:
If we say this is right, then I suggest for the
URLParserInit
we should also change the spec & Chromium to have theinputs
array contain the "processed"URLParserInit
instead of the original.The text was updated successfully, but these errors were encountered: